2-433
2 Instruction Descriptions
NJ-series Instructions Reference Manual (W502)
Conversion Instructions
2
DtToString
DtToString
The DtToString instruction converts a date and time to a text string.
The DtToString instruction converts date and time In to a text string. A NULL character is placed at the
end of text string Out.
An example when In is 2010-5-23-07:00:15.873232345 (7:00 am and 15.873232345 seconds on May
23, 2010) is given below. The value of variable abc will be ‘2010-05-23-07:00:15.873232345’.
Instruction Name FB/FUN Graphic expression ST expression
DtToString Date and
Time-to-Text String
Conversion
FUN Out:=DtToString(In);
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,
seconds
DT#197
0-1-1-
0:0:0
Out Text string Output Text string 30 bytes (29 single-byte
alphanumeric charac-
ters 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
(@)DtToString
EN ENO
In Out
abc:=DtToString(DT#2010-05-23-07:00:15.873232345);
LD
ST
abc
DT#2010-05-23-07:00:15.873232345
DtToString
EN ENO
In