2 Instruction Descriptions
2-556
NJ-series Instructions Reference Manual (W502)
SUB_DT_DT
The SUB_DT_DT instruction subtracts another date and time from another date and time.
The SUB_DT_DT instruction subtracts date and time In2 from date and time In1. The result of subtrac-
tion in Out is a time.
The following example is for when In1 is DT#1970-1-7-0:0:0 and In2 is DT#1970-1-2-0:0:0.
Instruction Name FB/FUN Graphic expression ST expression
SUB_DT_DT Subtract Date and
Time
FUN Out:=SUB_DT_DT(In1,
In2);
Variables
Name Meaning I/O Description Valid range Unit Default
In1 Date and
time 1
Input
Date and time 1
Depends on data type.
Year, month,
day, hour,
minutes, sec-
onds
DT#197
0-1-1-
0:0:0
In2 Date and
time 2
Date and time 2
Out Resulting
time
Output Resulting time Depends on data type. ns
---
Boolean
Bit strings Integers
Real
numbers
Times, durations,
dates, and text strings
BOOL
BYTE
WORD
DWORD
LWORD
USINT
UINT
UDINT
ULINT
SINT
INT
DINT
LINT
REAL
LREAL
TIME
DATE
TOD
DT
STRING
In1 OK
In2 OK
Out OK
Function
(@)SUB_DT_DT
EN ENO
In1 Out
In2
abc:=SUB_DT_DT(DT#1970-1-7-0:0:0,
DT#1970-1-2-0:0:0);
LD
ST
abc
DT#1970-1-7-0:0:0
DT#1970-1-2-0:0:0
SUB_DT_DT
EN ENO
In1
In2
−
In1
In2
Out=abc
DT#1970-1-7-0:0:0
DT#1970-1-2-0:0:0
T#5d