2-435
2 Instruction Descriptions
NJ-series Instructions Reference Manual (W502)
Conversion Instructions
2
DateToString
DateToString
The DateToString instruction converts a date to a text string.
The DateToString instruction converts date In to a text string. A NULL character is placed at the end of
Out.
An example when In is 2010-5-23 (May 23, 2010) is given below. The value of variable abc will be
‘2010-05-23’.
An error occurs in the following case. ENO will be FALSE, and Out will not change.
• The conversion result exceeds the valid range of Out.
Instruction Name FB/FUN Graphic expression ST expression
DateToString Date-to-Text String
Conversion
FUN Out:=DateToString(In);
Variables
Name Meaning I/O Description Valid range Unit Default
In Date Input Date Depends on data type. Year, month,
day
D#1970-1-1
Out Text string Output Text string 11 bytes (10 single-byte
alphanumeric 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
Precautions for Correct Use
(@)DateToString
EN ENO
In Out
abc:=DateToString(D#2010-05-23);
LD ST
abc
D#2010-05-23
DateToString
EN ENO
In