Many factors impact the answer.
If I said “3 am” and you hated getting up at 3 am so much that you never exercised you would do a whole lot worse than if you had just exercised when you got up naturally. Of course 3 am would be a weird time to exercise in any case, but you see my point. Choose a time of day convenient for you to do your exercise and it will help you build a habit.
Where do you live, and do you like outdoor or indoor? If you live in a desert area where it is cooler in the morning for example and you like to run, you might do well running earlier in the day. There are quite a lot of environmental aspects to exercise if you like to go outdoors.
If you like indoors, and go to a gym, you have to look at the times the gym you attend is open. Choosing a gym will be a combination of whether the times available work for you, and whether the programs and equipment work for you.
What kind of exercise? Personally I prefer not to do cardio too late in the day as it makes it a bit hard to sleep, though a short walk can be helpful. Yoga is nice in the evening, if it is not too much of a power class.
I have taught classes from 5 am to 8 pm. There are some differences. Early in the morning the body is a little tighter, but I find the energy is good. It is a great way to start the day, and I find aids with mental focus through the morning. A class before a light lunch helps refocus the mind, and seems (not citing research, but my own experience) to be helpful in making more healthful choices with lunch. After work classes are really nice for letting go of the stress of the day, and seem to help with sleep.
I am sure there is research on this, and if you are the kind of person who will exercise no matter what and is training to get the maximum edge for some competition, or something like that you should be able to find that. But for the average person trying to get strong and healthy finding what works for you in your situation is usually a good way to go.
I think you may find different answers to this one (and there are a number of studies out there on this), but it will really come down to your own natural body clock, your time management, and what works the best for you. Are you an early bird or a night owl? You may find you will stick to a more consistent exercise routine if you listen to your body.
If you are a morning person–good for you! Working out in the morning may both help you be consistent in your program (because you will be less likely to make an excuse in the morning, compared to later in the day when things come up), and it could help you sleep better. If you exercise too close to bedtime, it could interfere with your sleep. That being said, if you find you can get in a workout in the evening and it works for you, then go ahead!
Bottom line is whatever works for you!
I am with the others. The best time is the one you can make available. That said, it would be great if you could have eaten a little bit before to give yourself some energy to exercise.
I must confess, though, that I worked out for many years at 5:30 in the morning without having eaten anything at all. I am not a morning person but it was the only time when I still had control over my day before going to my corporate job.
I agree with other’s posts.
The best time of day to workout is when you will be most consistent with your routine, when you are properly fueled for maximum performance, and when it won’t disrupt your sleep.