When (and What) to eat before a workout
People tend to work out at different times of the day. You've got people who get their exercise in just before bed, and those who are on a yoga mat or treadmill first thing in the morning. Some people do pushups during their work breaks, others go to the gym when work has ended.
Of course, the problem with planning your workouts doesn't come from the workouts themselves, but instead comes from planning your nutrition. If you're working out heavily in the office gym and then you don't get anything to eat for three hours, you're not going to see the results you want.
A helpful article about eating after workouts here.
Now, of course, the question to ask is why you're working out. Do you want to lose weight? Or do you want to gain muscle. You can do both, obviously, but what's your focus?
If it's losing weight, the simple answer is that you should be doing fasted workouts, meaning you'll probably want to work out in the morning, or any time in the day you haven't eaten for about four hours. These workouts cause your body to break down its own adipose (fat) tissue for energy.
If it's about fitness or muscle building, however, it's a good idea to have fuel in you. The makeup of that 'fuel' depends on when you're filling the tank. Sorry, I'll end the confusing metaphors there.
Ideally, you should be eating a good sized (for your body weight) meal of about a 40-40-20 ratio of protein to carbs to fats (healthy fats) around 1-2 hours before your workout, so that your digestive process can get underway. As it gets closer to your workout, from 1 hour to 15 minutes beforehand, try a light meal that's mostly carbs. Good examples of these would be; a handful of nuts, raisins or some small crackers. If you've got 15 minutes before you're supposed to start your workout and you really can't delay it, try some sips of a sports drink, or better, a smoothie, to give you the energy you need, and then really focus on that post-workout meal.
In conclusion, making sure you have the fuel you need is important for a good workout, unless you're trying to lose weight, in which case you have to make sure you don't have that fuel. In either case, however, you have to have discipline! Stick rigidly to your meal plans just as much as you do to your workouts, they'll make up half of your progress and it's pointless to work out if you won't get anything from it.