To know when we must first understand what we are trying to do and what muscle really is. Do you want to temporarily lengthen your muscle tissue for workouts or create long-lasting effects and become more limber overall? Once you make that distinction, there are two general directions you can take to stretching and we'll discuss both of them. It is important to understand that regardless of which adaptation you desire, stretching is a continuum and you will see results on both sides.
As far as how we look at muscle, think about it like a rubber band. If you keep tension on it for a long time ( holding long stretches ), the band lengthens eventually beyond its original length. However, if you snap the rubber band, temporarily you get length but it eventually returns to its original length.
5-minute general warmup i.e. bike/treadmill/ jump rope
Foam roll muscle tissue
Above is a summarized example of how you want to go into a workout every single time. Raises your body temp, works through tight muscle tissue, and then dynamically lengthens the tissue allowing for the temporary length that wasn't there prior to the workout. I would end the workout with another 5-10 minutes of general stretching depending on the intensity of the session.
Again, if you do not care about becoming more flexible beyond your current capability this a stretching routine that would at least let you maintain current flexibility at the minimum. As you become more efficient in your warmup and workouts, you could see additional flexibility.
Long Lasting Prep:
Repeat the above prior to any workout.
I want to go back to the rubber band analogy because it plays a big role when thinking about long-lasting effects. To become more flexible in general, you need to generally do more flexibility. A little more tension over a long period of time gives you the flexibility desired.
On top of the above workout prep, I would do another session solely dedicated to stretching and start short. 5-10 minutes, slowly add as you wish. However, at some point adding more time isn't going to be your answer. Being able to feel a stretch better with less time dedicated to it than with shitty form and more time will go a lot further. I would as well bring to your attention, do not stretch first thing in the morning. Your muscles are cold and tight, much like a new rubber band. The second session or if you just want to stretch that day, get your body moving throughout the day prior to it. Think about how loose you feel after a sauna, that is your muscle tissue is re
laxed which is a lot easier to stretch!
Hope this helps, stay limber!