DATE_and_TOD_To_DT

Combines the date of type DATE and the time of type TIME_OF_DAY (TOD) to the time information of type DATE_AND_TIME (DT).

Namespace: Tc3_Collections
Library: Tc3_Collections (Tc3_Collections.compiled-library)

Syntax

FUNCTION DATE_and_TOD_To_DT : DT
VAR_INPUT
    d             : DATE;
    t             : TOD;
END_VAR
VAR_OUTPUT
    wMilliseconds : WORD;
END_VAR

DATE_and_TOD_To_DT 1: Inputs

Name

Type

Description

d

DATE

Date.

t

TOD

Time.

DATE_and_TOD_To_DT 2: Outputs

Name

Type

Description

wMilliseconds

WORD

Millisecond rest of the TOD time which could not be converted to the DATE_AND_TIME type. The DATE_AND_TIME type has the max. resolution of one second.

DATE_and_TOD_To_DT 3: Return value

Name

Type

Description

DATE_and_TOD_To_DT

DT

Combined time information of type DATE_AND_TIME.

Sample

PROGRAM MAIN
VAR
    d             : DATE:= D#2022-09-15;
    t             : TOD:=TOD#17:24:56.789;
    dateAndTime   : DT;
    wMilliseconds : WORD;
END_VAR
d:=D#2022-09-15;
t:=TOD#17:24:56.789;
dateAndTime:=DATE_and_TOD_To_DT(d:=d, t:=t, wMilliseconds=>wMilliseconds);(* Result is: DT#2022-09-15-17:24:56, wMilliseconds = 789 *)

d:=D#2022-08-16;
t:=TOD#10:00:00.000;
dateAndTime:=DATE_and_TOD_To_DT(d:=d, t:=t, wMilliseconds=>wMilliseconds);(* Result is: DT#2022-08-16-10:00:00, wMilliseconds = 0 *)