Time Zones 
Author Message
 Time Zones

Anyone know how to grab the time zone that a computer is setup for?

Ken



Sat, 02 Aug 2003 03:06:38 GMT  
 Time Zones
Quote:

> Anyone know how to grab the time zone that a computer is setup for?

Yes. The api is gettimezoneinformation(). The bad news is the timezone
is returned as a wide string. If you have a subscription to Clarion
mag, my current ole article has a string class in the downloadable that
converts wide strings to cw string among other things.

This is the only code I have handy:
     GetTimeZoneInformation(long),ulong,Pascal,RAW,proc

TIME_ZONE_INFORMATION   GROUP
Bias                    LONG
StandardName             byte,dim(64) !will clear to 0's
StandardDate             LIKE(systemTIME)
StandardBias             LONG
DaylightName             byte,dim(64)
DaylightDate             LIKE(SYSTEMTIME)
DaylightBias             LONG
                        END
TZ_Info                 long,auto
Bias                    long,auto

      TZ_Info=GetTimeZoneInformation(Address(TIME_ZONE_INFORMATION))
      Clear(Bias) !Hours from GMT
      If TZ_Info = 2 !daylight
        bias =
(TIME_ZONE_INFORMATION.bias+TIME_ZONE_INFORMATION.daylightbias)/60
      Elsif tz_Info = 1 !std
        bias =
(TIME_ZONE_INFORMATION.bias+TIME_ZONE_INFORMATION.Standardbias)/60
      End

      the short cut way to get the timezone is read everyother byte out
of the byte array.  For most cases, every other byte is just 0.

----------------------------------
Jim Kane
Team SoftVelocity
Productive Software Solutions
Cant find the message?
Get Organized, Get ForKeeps
www.fkeeps.com



Sat, 02 Aug 2003 04:58:55 GMT  
 Time Zones
Thanks

Ken


Quote:

> > Anyone know how to grab the time zone that a computer is setup for?

> Yes. The api is gettimezoneinformation(). The bad news is the timezone
> is returned as a wide string. If you have a subscription to Clarion
> mag, my current ole article has a string class in the downloadable that
> converts wide strings to cw string among other things.

> This is the only code I have handy:
>      GetTimeZoneInformation(long),ulong,PASCAL,RAW,proc

> TIME_ZONE_INFORMATION   GROUP
> Bias                    LONG
> StandardName             byte,dim(64) !will clear to 0's
> StandardDate             LIKE(systemTIME)
> StandardBias             LONG
> DaylightName             byte,dim(64)
> DaylightDate             LIKE(SYSTEMTIME)
> DaylightBias             LONG
>                         END
> TZ_Info                 long,auto
> Bias                    long,auto

>       TZ_Info=GetTimeZoneInformation(Address(TIME_ZONE_INFORMATION))
>       Clear(Bias) !Hours from GMT
>       If TZ_Info = 2 !daylight
>         bias =
> (TIME_ZONE_INFORMATION.bias+TIME_ZONE_INFORMATION.daylightbias)/60
>       Elsif tz_Info = 1 !std
>         bias =
> (TIME_ZONE_INFORMATION.bias+TIME_ZONE_INFORMATION.Standardbias)/60
>       End

>       the short cut way to get the timezone is read everyother byte out
> of the byte array.  For most cases, every other byte is just 0.

> ----------------------------------
> Jim Kane
> Team SoftVelocity
> Productive Software Solutions
> Cant find the message?
> Get Organized, Get ForKeeps
> www.fkeeps.com



Sat, 02 Aug 2003 22:35:32 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. time zones, daylight saving time, and universal time

2. Time zone in MVS

3. How to make VW TimeZone use the system time zone automatically

4. Getting Dates with time Zone

5. Setting time zone

6. time zone

7. Programming in other time zone

8. API for Time Zone

9. Time zone information

10. Setting Time Zone for my scripts

11. Howto: Time Zone Adjustment?

12. Time Zones

 

 
Powered by phpBB® Forum Software