DT_TO_SYSTEMTIME
The "DT_TO_SYSTEMTIME" function allows a PLC variable in DATE_AND_TIME format (DT) to be converted to a Windows system time structure. The system time has a resolution of 1ms, while the resolution of DATE_AND_TIME is 1s. The "wMilliseconds" variable in the system time structure therefore always returns the value zero.
FUNCTION DT_TO_SYSTEMTIME : TIMESTRUCT
VAR_INPUT
DTIN : DT;
END_VAR
DTIN:: the date and time to be converted, in DATE_AND_TIME format.
Sample of a call in FBD:
PROGRAM SystemTimeTest
VAR
SystemTimeStruct :TIMESTRUCT;
END_VAR
Requirements
Development environment |
Target platform |
PLC libraries to include |
---|---|---|
TwinCAT v2.7.0 and above |
BCxxxx (165) |
Standard.Lb6, PlcSystemBC.Lb6, TcPlcUtilitiesBC.Lb6 |