It is true that every food has its own importance as you can only get maximum benefits when you use these at right time and if you take or use it on wrong time then this food can be harmful to you so you have to be careful to take it on right time.
best is to eat ur last meal of the day 3 hours before going to bed than theres no issue whatever u eat at night as long as its 3 hours before ur bed time