2 Instruction Descriptions
2-436
NJ-series Instructions Reference Manual (W502)
TodToString
The TodToString instruction converts a time of day to a text string.
The TodToString instruction converts time of day In to a text string. A NULL character is placed at the
end of Out. An example when In is 07:00:15.873232345 (7:00 am and 15.873232345 seconds) is given
below. The value of variable abc will be ‘07:00:15.873232345’.
Out is in nanoseconds. To get a text string in seconds or milliseconds, combine this instruction with the
LEFT or RIGHT instruction (page 2-522).
Instruction Name FB/FUN Graphic expression ST expression
TodToString Time of Day-to-Text
String Conversion
FUN Out:=TodToString(In);
Variables
Name Meaning I/O Description Valid range Unit Default
In Time of day Input Time of day Depends on data type. Hour,
minutes,
seconds
TOD#0:0:0
Out Text string Output Text string 19 bytes (18 single-byte alpha-
numeric characters plus the
final NULL character)
--- ---
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
(@)TodToString
EN ENO
In Out
abc:=TodToString(TOD#07:00:15.873232345);
LD ST
abc
TOD#07:00:15.873232345
TodToString
EN ENO
In