SYSTEMTIME_TO_STRING
The "SYSTEMTIME_TO_STRING" function converts Windows sytem time struct to string. The string format is: YYYY-MM-DD-hh:mm:ss.xxx, where:
- YYYY: Year (1601..9999);
- MM: Month (01..12);
- DD: Day (01..31);
- hh: Hour (00..23);
- mm: Minute (00..59);
- ss: Second (00..59)
- xxx: Millisecond (000..999)
FUNCTION SYSTEMTIME_TO_STRING : STRING(24)
VAR_INPUT
in :TIMESTRUCT;
END_VAR
in: The structure with the Windows system time requiring for the conversion.
Sample in ST:
PROGRAM MAIN
VAR
fbGetSystemTime : GETSYSTEMTIME;
fileTime : T_FILETIME;
sTime : STRING;
END_VAR
fbGetSystemTime(timeLoDW=>fileTime.dwLowDateTime, timeHiDW=>fileTime.dwHighDateTime );
sTime :=SYSTEMTIME_TO_STRING( FILETIME_TO_SYSTEMTIME( fileTime ) );
Online view:
Requirements
Development environment | Target system type | PLC libraries to include |
---|---|---|
TwinCAT v2.9.0 Build > 1031 TwinCAT v2.10.0 Build > 1241 | PC or CX (x86) | TcUtilities.Lib ( Standard.Lib; TcBase.Lib; TcSystem.Lib are included automatically ) |
TwinCAT v2.10.0 Build >= 1301 | CX (ARM) |