Not before, but in the afternoon.
For example, I exercise from 19-20 and go to sleep at midnight. But if I have a football match at, say, 23, then it's impossible to go to sleep afterwards, I'm too tired.
Try whatever works for you. Humans are meant to exercise in order to follow their natural metabolism cycle, so an hour of any exercise, just before dinner, works wonders.
I prefer to get my exercise in the late morning or early afternoon. Unless it's a very hot day, then I like to exercise in the morning while the day is heating up.