Hi
You can calculate hours for case with midnight rollover by formula
=EndTime-StartTime+(EndTime<StartTime)
(NB! The formula works when time interval is less than 24 hours)
The formulas to calculate night, day or evening time must include according
start/end times, and will be quite complex.
P.e. yo have times DayStart and DayEnd. Generally daytime will be calculated
as (It's on fly, check the formulas yourself):
DayTime=DayTime1+DayTime2
DayTime1=AND(StartTime<DayEnd,OR(EndTime>DayStart,EndTime<StartTime))*(MAX(StartTime,DayStart)-MIN(EndTime+(EndTime<StartTime),DayEnd))
DayTime2=AND(EndTime<StartTime,EndTime>DayStart)*(MIN(EndTime,DayEnd)-DayStart)
As follows
DayTime=AND(StartTime<DayEnd,OR(EndTime>DayStart,EndTime<StartTime))*(MAX(StartTime,DayStart)-MIN(EndTime+(EndTime<StartTime),DayEnd))+AND(EndTime<StartTime,EndTime>DayStart)*(MIN(EndTime,DayEnd)-DayStart)
etc.