GetLocalTimeOffset

Return local timezone offset

Declaration

Source position: datih.inc line 204

  function GetLocalTimeOffset : Integer;
  function GetLocalTimeOffset(const DateTime: TDateTime; 
                             const InputIsUTC: Boolean; 
                             out Offset: Integer) : Boolean;
  function GetLocalTimeOffset(const DateTime: TDateTime; 
                             const InputIsUTC: Boolean) : Integer;

Description

GetLocalTimeOffset returns the local timezone offset in minutes. This is the difference between UTC time and local time:

UTC = LocalTime + GetLocalTimeOffset

The TDateTime-overloads return the offset at the specified DateTime. In case the TDateTime-aware function is not supported on the current platform, False is returned or it falls back to the offset to current time (depending on the overload used).

Note that on Linux/Unix, the information returned from the TDateTime-unaware function may be inaccurate around the DST time changes (for optimization). In that case, the unix.ReReadLocalTime unit must be used to re-initialize the timezone information.

The TDateTime-aware overloads are supported currently only on Windows Vista and newer.

See also

Name Description
Date Return the current date.
Now Returns the current date and time.
unix.ReReadLocalTime Re-Read the local time files.
Time Returns the current time.