This is a technique used to reduce your caloric intake for the day. But eating at a certain time making you gain weight is a total myth.
It's really as simple as hitting your calories. It doesn't matter when you take them in. Just be at or under that magic number when your head hits the pillow.