API for Time Zone 
Author Message
 API for Time Zone

Hello,

Does anyone know the API and prototype for getting a local pc's time zone?

TIA,
Doug



Mon, 07 Nov 2005 12:40:55 GMT  
 API for Time Zone
Look at http://msdn.microsoft.com for the full description.

I used the following prototype and structure

  module('windows')
    GetTimeZoneInformation(ulong lpTimeZoneInformation), ulong, raw, Pascal,
name('GetTimeZoneInformation')
  .

lpTimeZoneInformation   group,pre(TZI)
Bias                              LONG
StandardName            string(32)
StandardDate              ulong
StandardBias              LONG
DaylightName              string(32)
DaylightDate                ulong
DaylightBias                 long
                                        .
  code
  if ~WC_GetTimeZoneInformation(address(lpTimeZoneInformation)) then
return(0) .

Derek Noffke
CapeSoft


Quote:
> Hello,

> Does anyone know the API and prototype for getting a local pc's time zone?

> TIA,
> Doug



Mon, 07 Nov 2005 20:25:41 GMT  
 API for Time Zone
Thanks Derek!

Doug


Quote:
> Look at http://msdn.microsoft.com for the full description.

> I used the following prototype and structure

>   module('windows')
>     GetTimeZoneInformation(ulong lpTimeZoneInformation), ulong, raw,
pascal,
> name('GetTimeZoneInformation')
>   .

> lpTimeZoneInformation   group,pre(TZI)
> Bias                              LONG
> StandardName            string(32)
> StandardDate              ulong
> StandardBias              LONG
> DaylightName              string(32)
> DaylightDate                ulong
> DaylightBias                 long
>                                         .
>   code
>   if ~WC_GetTimeZoneInformation(address(lpTimeZoneInformation)) then
> return(0) .

> Derek Noffke
> CapeSoft



> > Hello,

> > Does anyone know the API and prototype for getting a local pc's time
zone?

> > TIA,
> > Doug



Mon, 07 Nov 2005 22:45:19 GMT  
 API for Time Zone
FAQ'd

Steve Parker

--------------------------------------------------
kb and download center at:
     www.par2.com
KB: http://www.par2.com/cws/c5launch.dll/FAQS/THEFAQS.exe.0
--------------------------------------------------

"The improbable, we do. The impossible takes a bit longer."



Mon, 07 Nov 2005 23:27:32 GMT  
 API for Time Zone
Hi Doug,

There's also a class and a sample program on Steve Parker's site www.par2.com that I
wrote.  It illustrates how to use all of the time zone information.

Cheers,
Larry Sand


| Hello,
|
| Does anyone know the API and prototype for getting a local pc's time zone?
|
| TIA,
| Doug
|
|



Tue, 08 Nov 2005 04:46:35 GMT  
 API for Time Zone
Thanks Larry.

It seems that I got it working.  However, the TimeZoneGroup var
"StandardName" seems to only return one character.  No matter what time zone
I pick, I seem to only get an "E" for Eastern Time, "P" for Pacific Time,
"M" for Mountain Time and Mid-Atlantic, etc.

MSDN docs suggests that I would get a few characters like "EST" for Eastern
Standard Time, and so on.

I'm on a W2k OS.  Maybe the results vary on different MS OS?

Doug


Quote:
> Hi Doug,

> There's also a class and a sample program on Steve Parker's site
www.par2.com that I
> wrote.  It illustrates how to use all of the time zone information.

> Cheers,
> Larry Sand



> | Hello,
> |
> | Does anyone know the API and prototype for getting a local pc's time
zone?
> |
> | TIA,
> | Doug
> |
> |



Tue, 08 Nov 2005 09:21:55 GMT  
 API for Time Zone
Try changing the StandardName from a string to a cstring

Derek Noffke
CapeSoft


Quote:
> Thanks Larry.

> It seems that I got it working.  However, the TimeZoneGroup var
> "StandardName" seems to only return one character.  No matter what time
zone
> I pick, I seem to only get an "E" for Eastern Time, "P" for Pacific Time,
> "M" for Mountain Time and Mid-Atlantic, etc.

> MSDN docs suggests that I would get a few characters like "EST" for
Eastern
> Standard Time, and so on.

> I'm on a W2k OS.  Maybe the results vary on different MS OS?

> Doug



> > Hi Doug,

> > There's also a class and a sample program on Steve Parker's site
> www.par2.com that I
> > wrote.  It illustrates how to use all of the time zone information.

> > Cheers,
> > Larry Sand



> > | Hello,
> > |
> > | Does anyone know the API and prototype for getting a local pc's time
> zone?
> > |
> > | TIA,
> > | Doug
> > |
> > |



Tue, 08 Nov 2005 13:44:06 GMT  
 API for Time Zone
Hi Doug,

You're welcome.

The problem is that the strings are Unicode.  Since Clarion doesn't have support for
Unicode strings you must convert them to ANSI with the Windows API WideCharToMultiByte().

The class that I mentioned on Steve Parker's download site contains a complete example of
how to read and interpret all of the information in the time zone structure.  Look it up
and examine the code.

The time zone names will look like "Eastern Standard Time."  You will see the same result
on Windows 95-ME and NT4, W2K, and XP.

HTH,
Larry Sand


| Thanks Larry.
|
| It seems that I got it working.  However, the TimeZoneGroup var
| "StandardName" seems to only return one character.  No matter what time zone
| I pick, I seem to only get an "E" for Eastern Time, "P" for Pacific Time,
| "M" for Mountain Time and Mid-Atlantic, etc.
|
| MSDN docs suggests that I would get a few characters like "EST" for Eastern
| Standard Time, and so on.
|
| I'm on a W2k OS.  Maybe the results vary on different MS OS?
|
| Doug
|



Tue, 08 Nov 2005 21:40:28 GMT  
 API for Time Zone
Great.  I'll check the more detailed example at Parkers site.

Doug


Quote:
> Hi Doug,

> You're welcome.

> The problem is that the strings are Unicode.  Since Clarion doesn't have
support for
> Unicode strings you must convert them to ANSI with the Windows API

WideCharToMultiByte().
Quote:

> The class that I mentioned on Steve Parker's download site contains a
complete example of
> how to read and interpret all of the information in the time zone

structure.  Look it up
Quote:
> and examine the code.

> The time zone names will look like "Eastern Standard Time."  You will see
the same result
> on Windows 95-ME and NT4, W2K, and XP.

> HTH,
> Larry Sand



> | Thanks Larry.
> |
> | It seems that I got it working.  However, the TimeZoneGroup var
> | "StandardName" seems to only return one character.  No matter what time
zone
> | I pick, I seem to only get an "E" for Eastern Time, "P" for Pacific
Time,
> | "M" for Mountain Time and Mid-Atlantic, etc.
> |
> | MSDN docs suggests that I would get a few characters like "EST" for
Eastern
> | Standard Time, and so on.
> |
> | I'm on a W2k OS.  Maybe the results vary on different MS OS?
> |
> | Doug
> |



Wed, 09 Nov 2005 08:06:45 GMT  
 
 [ 9 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. Time Zones

9. Time zone information

10. Setting Time Zone for my scripts

11. Howto: Time Zone Adjustment?

12. Time Zones

 

 
Powered by phpBB® Forum Software