2 Instruction Descriptions
2-576
NJ-series Instructions Reference Manual (W502)
DateToSec
The DateToSec instruction converts a date to the number of seconds from 00:00:00 on January 1,
1970.
The DateToSec instruction converts 00:00:00 on date In to the number of seconds from 00:00:00 on
January 1, 1970. The converted value is in seconds.
The following example is for when In is D#1970-1-2.
[
Use the SecToDate instruction (page 2-580) to convert the number of seconds from 00:00:00 on Janu-
ary 1,1970 to a date.
Instruction Name FB/FUN Graphic expression ST expression
DateToSec Convert Date to
Seconds
FUN Out:=DateToSec(In);
Variables
Name Meaning I/O Description Valid range Unit Default
In Date Input Date Depends on data type. Year, month,
day
DT#197
0-1-1
Out Seconds Output Number of seconds from
00:00:00 on January 1, 1970
0 to 18446659200 Seconds
---
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
Function
Additional Information
(@)DateToSec
EN ENO
In Out
abc:=DateToSec(D#1970-1-2);
D#1970-1-2
LD ST
abc
DateToSec
EN ENO
In
−
D#1970-1-2
DT#1970-1-1-0:0:0.000000000
LINT#86400
s
In
Out=abc