Probably AM. If you exercise at night, you're going to release endorphins that may keep you awake. Although everyones different. There are certain people that hit the gym early am to get a good night's sleep and some can do it right prior to sleep. However, I think generally speaking your best bet is am or mid-afternoon.