0

Calculating a time duration over midnight

I am new to Ninox.  Is there a simpler way to calculate a time duration over midnight?  When the time interval does not cross midnight, I could simply use the formula

Stop - Start

So if Start = 7:00 AM and if Stop = 1:00 PM, then the formula would calculate to 6:00.

I have created a workaround by creating a field called (Midnight) that autogenerates a time of 11:59 PM for each record.

if Stop - Start > 0 then
Stop - Start
else
Stop + '(Midnight)' - Start
end

However, this is clunky, it only works if each record has the extra field and does not change it, and it is one minute off.  Is there another way to accomplish calculating a time duration over midnight?  If there is a way to insert the value 11:59 PM into the formula, even just that would be helpful.  I get an error when I attempt to mix adding a field time with a fixed time.  Thank you.

2 replies

null
    • Alain_Fontaine
    • 3 yrs ago
    • Reported - view

    You can add:  timeinterval(86400000). The magical number in the argument is the number of milliseconds in a day.

    • DataCrusher
    • 3 yrs ago
    • Reported - view

    Beautiful.  Thank you!