Groups | Blog | Home
all groups > dotnet internationalization > december 2006 >

dotnet internationalization : How can I get an abbreviation of the time zone?


news.microsoft.com
12/1/2006 5:53:36 PM
Hi everyone, I'm trying to create a time string of the format 11/28/06
6:24:24 PM EST with C#, and I can get the full name of "Eastern Standard
Time", but I don't see a method to retrieve the abbreviation. Is there a
way to do this? The equivalent in Java as far as I know is the 'z' value in
their format string. The 'z' specifier in .net displays the time zone
offset from GMT though, and not the abbreviated timezone. Are there any
libraries available to retrieve the abbreviation based on the time zone
string or a method in dotnet to retrieve the abbreviation?

Any help is appreciated!
Thanks, dan

aldod NO[at]SPAM online.microsoft.com (
12/7/2006 11:08:13 PM
Hi dan, I don't think this is possible with the standard libraries. Java
probably implements something like the RFC 822 for dates/times but the .Net
Framework does not and therefore the definitions of EST/PST/... are not
required. I won't start debating why I think it would be more appropriate
for your application to use UTC dates internally - you probably already
know. For display purposes to the end users, I suggest you use LocalTime
(assuming you can detect where the client is) or an ISO 8601 format which
is understandable worldwide.
Should you need to convert through TimeZones you might want to look at this
lblog post which link a code sample.
<http://blogs.msdn.com/bclteam/archive/2006/04/03/567119.aspx>
Other than the usual detailed info you can find on MSDN, you can also find
some comparative info here <http://www.hackcraft.net/web/datetime/>

HTH
Aldo
-- This posting is provided "AS IS" with no warranties, and confers no
rights.


--------------------
| From: "news.microsoft.com" <djo267 at hotmail dot com>
|
| Hi everyone, I'm trying to create a time string of the format 11/28/06
| 6:24:24 PM EST with C#, and I can get the full name of "Eastern Standard
| Time", but I don't see a method to retrieve the abbreviation. Is there a
| way to do this? The equivalent in Java as far as I know is the 'z' value
in
| their format string. The 'z' specifier in .net displays the time zone
| offset from GMT though, and not the abbreviated timezone. Are there any
| libraries available to retrieve the abbreviation based on the time zone
| string or a method in dotnet to retrieve the abbreviation?
|
| Any help is appreciated!
| Thanks, dan
|
|
|
AddThis Social Bookmark Button