FILETIME_TO_DT

FILETIME_TO_DT 1:

The function "FILETIME_TO_DT" converts time from FILETIME format into DATE_AND_TIME format (DT). The DT format has a smaller value range than the FILETIME format and only an accuracy of seconds. On this account the  FILETIME value to convert is limited. The allowed minimum conforms to the value DT#1970-01-01-00:00:00 and the maximum to DT#2106-02-06-06:28:15.

FUNCTION FILETIME_TO_DT : DT

VAR_INPUT
    fileTime        : T_FILETIME;
END_VAR

fileTime: Time to convert in FILETIME format.

Example in ST:

PROGRAM MAIN
VAR
    fbSystemTime    : GETSYSTEMTIME;
    timeAsFileTime  : T_FILETIME;
    timeAsDT    : DT;
END_VAR
fbSystemTime( timeLoDW =>timeAsFileTime.dwLowDateTime , timeHiDW =>timeAsFileTime.dwHighDateTime );
timeAsDT := FILETIME_TO_DT( timeAsFileTime );

Requirements

Development environment

Target System

PLC libraries to include

TwinCAT v2.9.0 Build > 1031 and higher

TwinCAT v2.10.0 Build > 1240 and higher

PC or CX (x86)

TcUtilities.Lib

( Standard.Lib; TcBase.Lib; TcSystem.Lib are included automatically )

TwinCAT v2.10.0 Build >= 1301

CX (ARM)