LDT_To_DTL_Local

 Function - Converts a long date and time (LDT) to a field-expanded calendar date and time (DTL), expressed in local time.

  • The controller's configured time zone and daylight-saving rules are applied during the conversion.
  • Use DTL_To_LDT_Local to perform the reverse conversion.
  • For a UTC conversion, use LDT_To_DTL_UTC.

Inputs

Input

Data Type

See Data Types.

Range

Unit

Default

Description

input

LDT

N/A

Nanoseconds

No default

The timestamp to convert.

output

DTL

N/A

N/A

No default

Outputs

Output

Data Type

See Data Types.

Range

Unit

Description

Q

BOOL

FALSE, TRUE

N/A

If TRUE, the conversion completed successfully.

DTL Structure Members

Member

Data Type

Range

Description

Year

UINT

1677 to 2262

The calendar year.

Month

USINT

1 to 12

The calendar month.

Day

USINT

1 to 31

The calendar day of the month.

Hour

USINT

0 to 23

The hour of the day.

Minute

USINT

0 to 59

The minute of the hour.

Second

USINT

0 to 59

The second of the minute.

Nanosecond

UDINT

0 to 999,999,999

The sub-second part, in nanoseconds.

FBD Language Example

FFLD Language Example

IL Language Example

Not available.

ST Language Example

// Obtain the current time, then convert it to a local calendar date and time.
Ok := LDT_Now(MyLDT);
IF Ok THEN
   Ok := LDT_To_DTL_Local(MyLDT, MyDTL);
   IF Ok THEN
      // MyDTL now holds the current local calendar date and time.
   END_IF;
END_IF;