Applies To:
  • CitectSCADA 5.xx, 6.xx, 7.00
  • CitectHMI 5.xx, 6.xx, 7.00
  • CitectFacilities 5.xx, 6.xx, 7.00


TimeMidnight() returns a time that is one hour off from midnight when used for the day daylight savings time (DST) begins or ends.



The TimeMidnight() function is supposed to return the Citect time/date variable value for the beginning of the specified day (midnight). However, it assumes 24 hours in each day, so if the specified time is after the clock has been adjusted for DST, it will not subtract the correct number of hours to get the beginning of the day. We are researching this problem and will post new information here as it becomes available.

The following Cicode can be used to work around this issue. It will return the correct time value for midnight on any day in or out of daylight savings time.

// Returns a time/date variable at midnight for the specified date/time
// This is to work around a problem where TimeMidnight() returns 1:00 AM
// on the day daylight savings time ends
TimeMidnightFix(INT iTime)
		INT cDateExtended = 9;
		RETURN StrToDate(TimeToStr(iTime, cDateExtended));