DT_ARINT_TO_STRING: Converting a PL7 date into a character string
Original instructions
Description of the function
The function DT_ARINT_TO_STRING converts a PL7 date (table of four words) into a character string.
The additional parameters EN and ENO can be configured.
Representation in FBD
Representation:
Representation in LD
Representation:
Representation in IL
Representation:
LD Date1
DT_ARINT_TO_STRING
ST Result_Str
Representation in ST
Representation:
Result_Str:= DT_ARINT_TO_STRING(Date1);
Description of parameters
The following table describes the input parameters:
Parameter
Type
Comment
Date1
ARRAY [0..3] of INT
PL7 date (table of 4 words) to convert into character string format.
The following table describes the output parameters:
Parameter
Type
Comment
Result_Str
Result_Str is a string of 19 characters containing a date (including the time) in the following format: YYYY-MM-DD-HH:MM:SS.
Example: ’2000-12-27-23:15:50’
Runtime errors
If the string Result_Str is too short to contain the date (length = less than 19 characters), the date is truncated and the bit %S15 is set to 1.
If Date1 cannot be interpreted and is not consistent, the system bit %S18 is set to 1 and Result_Str =’YYYY-MM-DD-HH:MM:SS’.
PL7 DATE_AND_TIME format
The PL7 DATE_AND_TIME (DT) format is displayed as follow:
yyyy-mm-dd-hh:mm:ss
example 2000-05-18-15:45:22
the value is BCD coded on 64 bit. The result is an array of 4 integers.
With the previous example in hexadecimal.
NOTE: Only the DT included between [1990-01-01-00:00:00, 2099-12-31-23:59:59] are allowed.