CONCAT_DT block

Short summary

Name

CONCAT_DT

→POU type

→function

Category

IEC-block, Time, block with internal error diagnostic

Conform to →IEC-standard

images/s/b2ic8e/9012/1ca6q62/_/images/icons/emoticons/check.svg no restrictions

Graphical interface

images/download/thumbnails/414782771/CONCAT_DT-version-1-modificationdate-1535105026273-api-v2.png

Available since

version 1.27.0 (for logi.CAD 3)

Functionality

The block concatenates (combines) values to a date with time of day (DATE_AND_TIME). Enter the values at the corresponding inputs.

Special cases (see under "Example for usage within ST-editor" ) :

  • If one or more inputs get a value outside the below specified range, logi.CAD 3 increases or decreases the returned date with time of day accordingly.

  • If no value or value 0 is entered for the month, the last month of the preceding year is returned.

  • If no value or value 0 is entered for the day, the last month of the preceding month is returned.

Inputs, return value


Identifier

→Data type

Description

Inputs:

YEAR

USINT, UINT, UDINT, ULINT, SINT, INT, DINT or LINT(corresponds to →generic data type ANY_INT)

year

MONTH

USINT, UINT, UDINT, ULINT, SINT, INT, DINT or LINT(corresponds to →generic data type ANY_INT)

month (1-12)

DAY

USINT, UINT, UDINT, ULINT, SINT, INT, DINT or LINT(corresponds to →generic data type ANY_INT)

day (1-31)

HOUR

USINT, UINT, UDINT, ULINT, SINT, INT, DINT or LINT(corresponds to →generic data type ANY_INT)

hours (0-23)

MINUTE

USINT, UINT, UDINT, ULINT, SINT, INT, DINT or LINT(corresponds to →generic data type ANY_INT)

minutes (0-59)

SECOND

USINT, UINT, UDINT, ULINT, SINT, INT, DINT or LINT(corresponds to →generic data type ANY_INT)

seconds (0-59)

MILLISECOND

USINT, UINT, UDINT, ULINT, SINT, INT, DINT or LINT(corresponds to →generic data type ANY_INT)

milliseconds (0-999)

Return value:

DATE_AND_TIME


Input EN and output ENO are available when →calling the block. See "Execution control: EN, ENO" for information on input EN and output ENO.

See:

Internal error diagnostic for block

The block checks the supposed return value.
If the return value would be < DT#1970-01-01-00:00: or > DT#2106-02-07-06:28:14.999 , the output ENO of the block is set to value FALSE (or an equivalent).

Example for usage within ST-editor

PROGRAM Test
VAR
result1, result2, result3, result4, result5, result6, result7, result8 : DATE_AND_TIME;
CheckENO2, CheckENO3, CheckENO5, CheckENO6, CheckENO7, CheckENO8 : BOOL;
END_VAR
 
result1 := CONCAT_DT(2014,3,17,12,33,12,0);
(* The variable 'result1' evaluates to 'DT#2014-03-17-12:33:12'. *)
result2 := CONCAT_DT(YEAR := 2014, MONTH := 1, DAY := 35, MILLISECOND := 2987, ENO => CheckENO2);
(* The variable 'result2' evaluates to 'DT#2014-02-04-00:00:02.987'. Reason: The values for 'DAY' and 'MILLISECOND' increase the other values. *)
(* The variable 'CheckENO2' evaluates to 'TRUE' because the return value is within the valid range. *)
result3 := CONCAT_DT(YEAR := 1968, MONTH := 1, DAY := 3000, ENO => CheckENO3);
(* The variable 'result3' evaluates to 'DT#1976-03-18-00:00:00'. Reason: The value for 'DAY' increases the other values. *)
(* The variable 'CheckENO3' evaluates to 'TRUE' because the return value is within the valid range. *)
result4 := CONCAT_DT(2015, 1, 1, 0, 0, 0, -1);
(* The variable 'result5' evaluates to 'DT#2014-12-31-23:59:59.999'. Reason: The value for MILLISECOND decreases the other values. *)
result5 := CONCAT_DT(YEAR := 1971, ENO => CheckENO5);
(* The variable 'result4' evaluates to 'DT#1970-11-30-00:00:00'. Reason: The missing value for MONTH decreases the value for 'YEAR' - and temporarily sets 'MONTH' to '12'.
The missing value for DAY decreases the returned values for 'MONTH' to '11' and for 'DAY' to '30'. *)
(* The variable 'CheckENO5' evaluates to 'TRUE' because the return value is within the valid range. *)
 
result6 := CONCAT_DT(YEAR := 1969, MONTH := 12, DAY := 17, ENO => CheckENO6);
(* The variable 'CheckENO6' evaluates to 'FALSE'. Reason: The supposed return value is not within the valid range. *)
result7 := CONCAT_DT(YEAR := 1971, MONTH := -13, ENO => CheckENO7);
(* The variable 'CheckENO7' evaluates to 'FALSE'. Reason: The supposed return value is not within the valid range. *)
result8 := CONCAT_DT(YEAR := 2120, MONTH := 12, DAY := 10, ENO => CheckENO8);
(* The variable 'CheckENO8' evaluates to 'FALSE'. Reason: The supposed return value is not within the valid range. *)
END_PROGRAM

When creating your application within the ST-editor, enter a call of a block by typing the text as requested by the syntax or use Content Assist.