SUB_TOD_TIME - Subtracts an interval from a time of day value

Help Contents

Introduction

Returns the result of an interval subtracted from a time of day.

Syntax

Informal Syntax:

SUB_TOD_TIME( In1, In2 )

Formal Syntax:

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

Parameters

ParameterTypeDescription
In1TIME_OF_DAYThe time of day value.
In2TIMEThe interval to subtract from the time of day value.

In2 can be any interval value, positive or negative.

Return Value

The function SUB_TOD_TIME returns a TIME_OF_DAY value, the result of In1 - In2.

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 to 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.

Examples

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

Standards Compliance

IEC 61131-3 Second Edition: Table 30.6b.

IEC 61131-3 Third Edition: Table 35.6b.

Further Information

Date and Time Functions

For other date and time functions.

Glossary

For the meaning of terms used in Fernhill SCADA.