CCalclabhub

Time & Dates

Day shift across midnight

Total minutes past midnight can be negative or exceed a day. Taking the floor of the division by the minutes in a day gives the day shift, and subtracting it back gives the clock within the day.

Last updated

The Formula

day shift = floor(target minutes / 1440); local minutes = target minutes - 1440 x day shift

Total minutes past midnight can be negative or exceed a day. Taking the floor of the division by the minutes in a day gives the day shift, and subtracting it back gives the clock within the day.

SymbolMeaning
m_tTotal minutes
dDay shift
m_LLocal minutes

What Each Symbol Means

m_tminutes

Total minutes

Target time as minutes, possibly out of range.

ddays

Day shift

How many days the destination has moved.

m_Lminutes

Local minutes

Minutes within the destination day.

See It Worked With Real Numbers

A formula on its own does not tell you which number goes where. The how to convert time zones page applies this equation to a concrete case, shows every intermediate step, and names the mistakes that produce a wrong answer even when the algebra is right.

Where This Formula Appears

This equation is the working core of How To Convert Time Zones, filed under Everyday Life. Every number the guide produces comes from substituting into this one line.

Common Questions

What is the formula for Day shift across midnight?

The formula for Day shift across midnight is day shift = floor(target minutes / 1440); local minutes = target minutes - 1440 x day shift. Total minutes past midnight can be negative or exceed a day. Taking the floor of the division by the minutes in a day gives the day shift, and subtracting it back gives the clock within the day.

What units should I use with Day shift across midnight?

Substitute m_t in minutes, d in days, m_L in minutes. Convert every input to those units before you start, because the equation only returns the right answer when the units on both sides agree.

What is a common mistake when using Day shift across midnight?

Adding the source offset instead of subtracting it. The source offset brings the local clock to UTC, so it is always subtracted. Adding it sends the answer in the wrong direction by twice the offset.