As close to when I wake up as possible. I find that it's easier to allow my mind to settle before all the little inconveniences of the day have begun to add up in the space of my mind.
I use to meditate as soon as I feel stressed or whenever I feel that I need it. So basically I'd say I sometimes meditate during the day, especially in the afternoon, but more in the evening when I am stressed or scared or whatever bad feelings and thoughts I can get in mind. Or when I only want to be relaxed to fall asleep quicker.
I meditate right before I get in bed to calm down, and unwind, so that I may have a better night’s sleep. However at any stressful time in the day it is good to just take a few deep breaths. I hope that this helps you!