Board index » delphi » Q: How can you obtain Timezone information ???

Q: How can you obtain Timezone information ???

G'day,

Does anyone know how to get the timezone information from Windows ??
In C, the runtime environment defines the tz variable and various timezone
functions.
The Delphi runtime environement doesn't appear to have anything similar.

Specifically all I want is the offset from GMT.
For example, Melbourne Australia is +10 hours

Any tips on how do get this info would be much appreciated.

Regards...Andrew
--
-----remove nospam- to reply

 

Re:Q: How can you obtain Timezone information ???


Quote
"Andrew Hacking" (andrew.hack...@nospam-datacraft.com.au) writes:
> G'day,

> Does anyone know how to get the timezone information from Windows ??
> In C, the runtime environment defines the tz variable and various timezone
> functions.
> The Delphi runtime environement doesn't appear to have anything similar.

> Specifically all I want is the offset from GMT.
> For example, Melbourne Australia is +10 hours

> Any tips on how do get this info would be much appreciated.

> Regards...Andrew
> --
> -----remove nospam- to reply

Take a look at TIME_ZONE_INFORMATION in the online help.
It is defined as :

typedef struct _TIME_ZONE_INFORMATION { // tzi

    LONG       Bias;
    WCHAR      StandardName[ 32 ];
    SYSTEMTIME StandardDate;
    LONG       StandardBias;
    WCHAR      DaylightName[ 32 ];
    SYSTEMTIME DaylightDate;
    LONG       DaylightBias;

Quote
} TIME_ZONE_INFORMATION;

I beliebe Bias is what you are after; the function GetTimeZoneInformation
may also be of interest.

Cheers.
--
Denis Boucher
Hull, Qubec
CANADA

Other Threads