2-559
2 Instruction Descriptions
NJ-series Instructions Reference Manual (W502)
Time and Time of Day Instructions
2
SUB_DT_TIME
The SUB_DT_TIME instruction subtracts a time In2 from a date and time In1. The result of subtraction
in Out is a date and time. Leap years are also accounted for.
The following example is for when In1 is DT#1970-1-1-0:0:0 and In2 is T#1d.
An error will not occur even if the subtraction result exceeds the valid range of Out.
• DT#2554-7-21-23:34:33.709551615 − T#-0.000001ms → DT#1970-1-1-0:0:0
• DT#1970-1-1-0:0:0 − T#0.000001ms → DT#2554-7-21-23:34:33.709551615
Function
Related System-defined Variables
Name Meaning Data type Description
_CurrentTime System Time of Day DT The time of day from the system clock. The num-
ber of seconds from 00:00:00 on January 1,1970.
Precautions for Correct Use
abc:=SUB_DT_TIME(DT#1970-1-7-0:0:0, T#1d);
LD
ST
abc
DT#1970-1-7-0:0:0
T#1d
SUB_DT_TIME
EN ENO
In1
In2
−
In1
In2
Out=abc
DT#1970-1-7-0:0:0
T#1d
DT#1970-1-6-0:0:0