FILETIME_TO_DT
The function "FILETIME_TO_DT" converts the time in FILETIME format to DATE_AND_TIME format (DT). The DT format has a smaller value range than the FILETIME format and only offers second accuracy. For this reason the FILETIME value to be converted is limited. The permitted minimum corresponds to value DT#1970-01-01-00:00:00 and the maximum to value DT#2106-02-06-06:28:15. Milliseconds are not considered in the conversion and are rounded down to the DATE_AND_TIME return value accordingly.
FUNCTION FILETIME_TO_DT : DT
VAR_INPUT
VAR_INPUT
fileTime : T_FILETIME;
END_VAR
fileTime: The time to be converted in FILETIME format (type: T_FILETIME).
Example:
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 platform |
PLC libraries to be integrated (category group) |
---|---|---|
TwinCAT v3.1.0 |
PC or CX (x86, x64, ARM) |
Tc2_Utilities (System) |