Time zones, GEOs, and Percents

by Michael S. Kaplan, published on 2005/11/06 13:15 -05:00, original URI: http://blogs.msdn.com/b/michkap/archive/2005/11/06/489583.aspx

John Bates asked in the Suggestion Box:

1. Will Vista/future NLS support expose timezone info get/set APIs? If so will it also be tied to the GeoInfo APIs?

2. Will Vista expose the percentage-related formatting currently in .NET's NumberFormat class in Win32?

Thanks in advance.

Well, of course there are the GetTimeZoneInformation and SetTimeZoneInformation functions in the Win32 API, both of which work with a TIME_ZONE_INFORMATION struct:

typedef struct _TIME_ZONE_INFORMATION {
    LONG Bias;
    WCHAR StandardName[32];
    SYSTEMTIME StandardDate;
    LONG StandardBias;
    WCHAR DaylightName[32];
    SYSTEMTIME DaylightDate;
    LONG DaylightBias;

Though of course as I mentioned before in the post It's not quite done yet, the GEO integration tantalizingly placed in the GetGeoInfo function with the GEO_TIMEZONES SYSGEOTYPE is not actually hooked right not. And the time zone functions I mentioned earlier do not take the ID values that the GEO function would return -- no function does. So the answer to what you meant to ask with the first question is not at the moment....

Though I can promise you that enhanced support in the whole area of time zones is getting higher and higher on the priority list in both Windows and the .NET Framework all the time.

The other question, about the percent formatting values, is that the current plan does not have them in Vista either. Percent formatting is actually one of the interesting features that was inherited in the .NET Framework from prior versions of Visual Basic and COM; you can actually notice the signs of this legacy when you see how many of the formatting values inherit information from the number formatting (though it looks like there may be a few cultues in which this may not be entirely correct).

Though this too is on the list of possible ideas for the future, at which point a GetPercentFormat function could be added to go alongside the GetNumberFormat and GetCurrencyFormat functions in the NLS API today.


This post brought to you by "" (U+ff05, a.k.a. FULLWIDTH PERCENT SIGN)

# Serge Wautier on 6 Nov 2005 5:40 PM:

I second John regarding the lack of an API to enumerate time zones and retrieve each time zone settings (not only the current one).

No offense, Michael, but with a new version of Windows every 5 years, a higher and higher priority on you guys priority list may not mean we'l get it soon :-(

# Michael S. Kaplan on 6 Nov 2005 9:09 PM:

Hi Serge --

I won't say I disagree with you on time zone issue, but I will say that when you don't the core functionality in question (time zones), it is much harder to add features to it (since there are many stakeholders and several different opinions on the best way to do things)....

Anonymous Coward on 16 Oct 2007 9:03 PM:

Checkout PublicDomain.dll which has Olson Time Zone database support, and also code to get all Win32 time zones in static method Win32.GetSystemTimeZones.




Please consider a donation to keep this archive running, maintained and free of advertising.
Donate €20 or more to receive an offline copy of the whole archive including all images.

go to newer or older post, or back to index or month or day