SPLIT_DT - Extracts the fields from a DATE_AND_TIME value

Help Contents

Introduction

Extracts the following fields from a DATE_AND_TIME value:

Syntax

Informal Syntax:

SPLIT_DT( IN, YEAR, MONTH, DATE, HOUR, MINUTE, SECOND, MILLISECOND )

Formal Syntax:

SPLIT_DT( IN:=expression,
  YEAR=>variable, MONTH=>variable, DATE=>variable
  HOUR=>variable, MINUTE=>variable, SECOND=>variable, MILLISECOND=>variable )

Parameters

ParameterTypeDescription
INDATE_AND_TIMEThe date and time value to split into separate fields.
YEARREF_TO INTThe year value extracted from the input value.
MONTHREF_TO INTThe month value extracted from the input value.
DATEREF_TO INTThe date value extracted from the input value.
HOURREF_TO INTThe date value extracted from the input value.
MINUTEREF_TO INTThe date value extracted from the input value.
SECONDREF_TO INTThe date value extracted from the input value.
MILLISECONDREF_TO INTThe date value extracted from the input value.

Return Value

None.

Examples

Example of an informal call:

VAR
    Year, Month, Date : INT;
    Hour, Minute, Second, MS : INT;
END_VAR

SPLIT_DT(
    DATE#2013-01-10-21:50:00.000,
    Year, Month, Date,
    Hour, Minute, Second, MS )

The variable values after the SPLIT_DT function call will be:

VariableValue
YearINT#2013
MonthINT#1
DateINT#10
HourINT#21
MinuteINT#50
SecondINT#0
MSINT#0

Standards Compliance

IEC 61131-3 Third Edition: Table 36.7a.

Further Information

Date and Time Functions

For other date and time functions.

Glossary

For the meaning of terms used in Fernhill SCADA.