To expand on Brian’s answer the official ACSM Guidelines are
Full meal >3 hours before exercises
3g/kg carbs 3 hours before exercise
2g/kg carbs before exercise
1g/kg carbs 1hour before exercise
(g/kg refers to athletes body weight bw in lbs/2.2 =bw in kg)
As the time shortens 3hrs–>1hr foods should go from more solid or harder to digest items (nuts, fats, fiber, etc) to more liquid based foods that are more easily digested such as yogurt or a banana.
I would also experiment and see what works for you and what doesn’t these are just general guidelines but what works varies person to person.
Hope this information helps!