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;
} TIME_ZONE_INFORMATION, *PTIME_ZONE_INFORMATION;
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:
# Michael S. Kaplan on 6 Nov 2005 9:09 PM:
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.
http://www.codeplex.com/publicdomain
and
http://www.codeproject.com/useritems/Using_time_zones_in_NET.asp