WSJ’s Life & Work team presents Life Math, a series on how to optimize your time in 2024. Today: Settling the controversy over when to eat.

Your grandparents were onto something with those early-bird dinners: The best time to eat the evening meal is four hours before bedtime.

Peak dinnertime in America is 6:19 p.m., but it varies from a little after 5 p.m. to after 8 p.m., depending on the part of the country, according to a statistician who analyzed time-use data from the U.S. Bureau of Labor Statistics. Nutritionists vary on when dinner should be served but agree it should be at least two hours before bedtime.

The most important factor in the dinnertime calculus is melatonin, the hormone that signals it’s time to sleep, says Satchidananda Panda, a professor at the Salk Institute for Biological Studies.

Melatonin, which begins to rise about three hours before we go to bed, also tells the pancreas to cut back on insulin production. If we have a sugar spike after eating late, our body has a harder time regulating blood sugar, Panda says. This could put us at risk of diabetes and other metabolic disorders. For that reason, he says the ideal dinnertime is three to four hours before bed.

What we eat for dinner matters, too. Slower-digesting food like meat keeps us full longer.

“Only in the last hundred years have we seen easily digestible, highly processed food,” Panda says, explaining that nearly 70% of the calories we eat now come from carbohydrates.

The modern American diet makes timing your family dinners even more important.

Forget the midnight snack

Late-night eating can cause the body to store more fat and reduce levels of leptin, the hormone that tells your brain when you’re full, according to a 2022 study from researchers at Brigham and Women’s Hospital in Boston and the University of Chicago. And a 2018 study from endocrinologists in Japan showed that people with Type 2 diabetes who ate dinner after 8 p.m. had poorer blood-sugar control.

Eating too late can affect sleep quality, which can lead to hormonal fluctuations that can cause weight gain, says Amy Kimberlain, a spokeswoman for the Academy of Nutrition and Dietetics. Going to bed on a full stomach can also exacerbate acid reflux, she says.

There are historical reasons for the dinnertime formula, too. The ritual of gathering for dinner began during the hunter-gatherer days, when everyone had to be home before dark to get the fire going, Panda says.

Hunter-gatherers went to sleep around 9:30 or 10 p.m., as the fire was dying, and woke up at dawn. They needed sustenance to keep them going until they could gather some nuts and berries in the morning. Dinnertime around sundown continued as people began farming.

The diet of hunter-gatherers and early agrarian cultures differed from ours. Dinner was high in protein and fiber with a bit of fat, Panda says. It was hard to digest and therefore perfect for a lengthy fast.

We also don’t move as much as our forebears. Hunter-gatherers and farmers walked 16,000 to 17,000 steps a day, Panda says, with a big spike in activity around dusk as they hurried home. We’re no longer out hunting prey all day—even if work can feel that way at times. The average American now walks just 3,000 to 4,000 steps a day, according to the Mayo Clinic.

So some nightly movement—even a brisk walk around the block before or after dinner—can help regulate your blood sugar before your pancreas turns in for the night.

The family that dines together

Anne Fishel doesn’t want anything to get in the way of families eating dinner together.

As the director of the Family Dinner Project at Massachusetts General Hospital, which tries to boost the frequency of shared family meals, she knows the mental and physical health benefits for children who regularly eat with their parents or caregivers. And yet American families are eating dinner together less often than they used to due to conflicting schedules.

“I hate to put any more roadblocks in the way of families gathering for dinner,” Fishel says, when asked to pinpoint the exact best nightly dinnertime.

The good news is you don’t need to worry about timing dinner to your kids’ bedtimes. Most children have a higher metabolism than adults and are more active in the evening. (Swing by my house around 9 p.m. and you’ll see my kids jumping on the couch or playing indoor volleyball.) That means their blood sugar isn’t as affected by meals, Panda says. If you’re going to do the dinnertime calculation, count back from the adults’ bedtime.

There are other benefits to families eating early. A 2021 study found that parents who eat dinner with their families before 6:15 p.m. spend more quality time with their children in the evening.

Be consistent

Kimberlain warns against getting too hung up on meal timing. “Schedules differ and what works for one might not work for another, therefore finding a dinnertime that will fit into your schedule is essential, and aiming for consistency is helpful,” she says.

In other words, the best dinnertime is the one you can stick to.

Penny Goffman, a Greenwich, Conn., entrepreneur, is adamant about an early dinnertime for her family, mostly because she and her husband are, in her words, “green smoothie people.”

Timing dinner requires careful planning, since their kids, ages 11 and 14, have weeknight sports practices and homework. She maps out the week’s meals on the weekends and writes them on a dry-erase board so no one has to ask what’s for dinner. They manage to eat together no later than 6:30 p.m. Monday through Thursday.

By 7 p.m., she says, “The kitchen is closed.”

—For Family & Tech columns, advice and answers to your most pressing family-related technology questions, sign up for my weekly newsletter.

Write to Julie Jargon at Julie.Jargon@wsj.com