The best time to exercise is when you are going to do it, although exercising 2 to 3 hours before bedtime can keep you from falling asleep easily.