ADD_TOD_TIME - Add an interval to a time of day value

Help Contents


Returns the sum of a time of day and an interval.


Informal Syntax:

ADD_TOD_TIME( In1, In2 )

Formal Syntax:

ADD_TOD_TIME( In1:=expression, In2:=expression )


In1TIME_OF_DAYThe time of day value.
In2TIMEThe interval to add to the time of day value.

Return Value

The function ADD_TOD_TIME returns a TIME_OF_DAY value, the result of adding In2 to In1.

In2 can be any interval value, positive or negative. The In1 parameter, and the return value are TIME_OF_DAY values, and have a valid range of 00:00:00.000 to 23:59:59.000. If the result is more than 23:59:59.999, a multiple of 24 hours is subtracted to bring the value back into range. If the result is less than 00:00:00.000, a multiple of 24 hours is added to bring the value back into range.


ExampleReturn Value
ADD_TOD_TIME( TOD#12:00:00.000, T#4h30m)TIME_OF_DAY#16:30:00.000
ADD_TOD_TIME( TOD#12:30:00.000, T#20h)TIME_OF_DAY#:08:30:00.000
ADD_TOD_TIME( TOD#12:30:00.000, T#-20h)TIME_OF_DAY#:16:30:00.000

Standards Compliance

IEC 61131-3 Second Edition: Table 30.2b.

IEC 61131-3 Third Edition: Table 35.2b.

Further Information

Date and Time Functions

For other date and time functions.


For the meaning of terms used in Fernhill SCADA.