Table of Contents

DECOMPOSEDATE

Function name

DECOMPOSEDATE

ST call

PROGRAM DECOMPOSEDATE_DEMO
 VAR
     DT1: DT;
        O1,Y:INT;
       M,D,DOW:SINT;
   END_VAR
 O1 := DECOMPOSEDATE(T := DT1, YEAR => Y, MONTH => M, DAY => D, DAYOFWEEK => DOW);
END_PROGRAM

Description

Converts a DATETIME variable to individual date components as integer values.

Inputs

InputTypeDescription
T DT Input value

Outputs

Output TypeDescription
INT Output value, 1 means that the conversion has been executed successfully
YEAR INT number of years
MONTH SINTnumber of months
DAY SINTnumber of days
DAYOFWEEKSINTday of week (Monday 1…Sunday 7)

Application example