The image above shows the starting position for this exercise. Make sure your heel is well supported by the chair, bed, sofa, stool, or whatever it is that you are putting your foot onto. Initially try this exercise with the leg bent at around 90 degrees in the starting position. If you cannot feel the stretch well, then you can always move backwards a little bit to increase the angle at the knee. This will give a stronger stretch. The foot is tilted back and you are facing directly forward.
The movement mostly involves bending forward at the waist from the starting position. You should also move your pelvis backwards slightly. Your knee should straighten a little as you do so. At some point you will feel a comfortable stretch in the middle of the hamstring muscles of the bent leg. Hold the stretch for 25 seconds, then gently return to the starting position and rest for 10 seconds. Repeat this exercise 3 times on each side, once or twice a day.