2-577
2 Instruction Descriptions
NJ-series Instructions Reference Manual (W502)
Time and Time of Day Instructions
2
TodToSec
TodToSec
The TodToSec instruction converts a time of day to the number of seconds from 00:00:00.
The TodToSec instruction converts the time of day in In to the number of seconds from 00:00:00. The
converted value is in seconds. The value is truncated below the seconds.
The following example is for when In is TOD#12:0:0.999999999.
[
Use the SecToTod instruction (page 2-582) to convert the number of seconds from 00:00:00 on January
1,1970 to a time of day.
Instruction Name FB/FUN Graphic expression ST expression
TodToSec Convert Time of
Day to Seconds
FUN Out:=TodToSec(In);
Variables
Name Meaning I/O Description Valid range Unit Default
In Time of day Input Time of day Depends on data type. Hour, min-
utes, seconds
TOD#0:0
:0
Out Seconds Output Number of seconds from
00:00:00
0 to 86399 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
(@)TodToSec
EN ENO
In Out
abc:=TodToSec(TOD#12:0:0.999999999);
TOD#12:0:0.999999999
LD
ST
abc
TodToSec
EN ENO
In
−
TOD#12:0.0.999999999
TOD#0:0:0.000000000
LINT#43200
s
In
Out=abc