Working Out

Well I went this morning to workout at the gym. I ahve to cool it for a while for my abs excercise. I pulled a muscle last week on thursday. But I tried today and it was a little better. I just have a quick question? WHat is hte best time to eat? After a workout or before? And how long should you eat after the workout or before?