Before exercise, in the warm-up, you want to prepare the muscle for activity. The best time to stretch is just after a short easy jog and to hold each stretch for 10 seconds. It is especially important if you intend to start an intense activity such as sprinting or speed-work.
After exercise, in the cool-down, you want to bring back the muscles used to their original length. During activity the muscle shortens, you notice this when the muscle gets tight and hard. To reduce or even prevent post exercise muscle stiffness you are now trying to lengthen and loosen the muscle back to its pre-exercise level. You should hold the stretch for longer – 30 seconds.