2-597
2 Instruction Descriptions
NJ-series Instructions Reference Manual (W502)
Time and Time of Day Instructions
2
DtToDateStruct
DtToDateStruct
The DtToDateStruct instruction converts a date and time to the year, month, day, hour, minutes, sec-
onds, and nanoseconds.
The DtToDateStruct instruction converts the date and time in In to the year, month, day, hour, minutes,
seconds, and nanoseconds. The data in the broken down date and time in Out is the structure _sDT.
The meanings of the members are as follows:
Instruction Name FB/FUN Graphic expression ST expression
DtToDateStruct Break Down Date
and Time
FUN Out:=DtToDateStruct(In,
DateStruct);
Variables
Name Meaning I/O Description Valid range Unit Default
In Date and
time
Input Date and time Depends on data type. Year, month,
day, hour,
minutes, sec-
onds
DT#197
0-1-1-
0:0:0
Out Return
value
Output
Always TRUE TRUE only
--- ---
DateStruct Date and
time
Date and time as a year,
month, day, hour, minutes,
seconds, and nanoseconds
---
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
In OK
Out OK
DateStruct Refer to Function for details on the structure _sDT.
Function
Name Meaning Content Data type Valid range Unit Default
Out Date and time Date and time as a year,
month, day, hour, minutes,
seconds, and nanoseconds
_sDT --- --- ---
Year Year Year UINT 1970 to 2554 Year
---
Month Month Month USINT 1 to 12 Month
Day Day Day USINT 1 to 31 Day
Hour Hour Hour USINT 0 to 23 Hour
Min Minutes Minutes USINT 0 to 59 Minutes
Sec Seconds Seconds USINT 0 to 59 Seconds
Nsec Nanoseconds Nanoseconds ULINT 0 to 999999999 Nanoseconds
(@)DtToDateStruct
EN ENO
In Out
DateStruct