F_EuropeanLocalTime

The function converts the UTC time (structured system time format) to local time (structured system time format), taking into account the specified offset information. The function may only be used within Europe and is not valid for any time zone in the world.
The function block FB_SystemTimeToTzSpecificLocalTime has a similar functionality, with the difference that it can be used worldwide. F_EuropeanLocalTime offers the advantage for applications within Europe that the processing time is shorter, making the function particularly suitable for small control systems.
In addition to the local time, the function provides information on whether it is daylight saving time or standard time. The function block uses the time zone information or the offset to calculate the required time steps (daylight saving time/standard time changeover) in local time.
Inputs
VAR_INPUT
UTC : TIMESTRUCT;
UTC_Offset : INT;
END_VAR
Name | Type | Description |
---|---|---|
UTC | UTC time (structured system time format) to be converted. | |
UTC_Offset | INT | Time zone offset in minutes. |
Outputs
VAR_OUTPUT
bDaylightSavingTime : BOOL;
END_VAR
Name | Type | Description |
---|---|---|
bDaylightSavingTime | BOOL | Additional daylight saving time/standard time information. If the output is TRUE, this is the daylight saving time. Otherwise it is standard time. |
Example:
PROGRAM MAIN
VAR
in : TIMESTRUCT := ( wYear := 2011, wMonth := 4, wDay := 29, wHour := 14, wMinute := 46, wSecond := 31, wMilliseconds := 99 );(* UTC time *)
out : TIMESTRUCT; (* Local time result is:= ( wYear := 2011, wMonth := 4, wDay := 29, wHour := 16, wMinute := 46, wSecond := 31, wMilliseconds := 99 ) *)
bSummerTime : BOOL;
END_VAR
out := F_EuropeanLocalTime( UTC := in, UTC_Offset := 60 (*Germany*), bDaylightSavingTime => bSummerTime );
Further time and time zone functions and function blocks:
Requirements
Development environment | Target platform | PLC libraries to be integrated (category group) |
---|---|---|
TwinCAT >= v3.1.4024.63 | PC or CX (x86, x64, Arm®) | Tc2_Utilities (System) >= v3.9.1.0 |