I usually eat 1-2 hours before the gym
Then about 50 minutes before the gym I will eat a snack like a banana, strawberries, peanuts, etc.
After the gym I'll then have a full meal because I usually eat every 2-3 hours. If you're new then I'd recommend taking protein shakes after but you can take them before too. I would always bring my protein shaker with water already in it and then post gym in my car drop my serving into it, shake and then drink.