getting the timezone name from an abbreviation

HI,

I am creating n onlinecalendar sort of functionality for which the user input for events is taken. To make it user friendly, its left to the user to write the time down rather than selecting it from a datetime field in a form . The user can also specify a timezone. And while doing so its obvious that most inputs will be an abbreviation.

My question is - is there a way to convert "PST" into the required timezone name or at least get the UTC offset for it?

Thanks in advance

dewdrops wrote:

My question is - is there a way to convert "PST" into the required timezone name or at least get the UTC offset for it?

Well, actually there is no "safe" way to do that. Some time zones share the same abbreviation. For example CST has at least three matching time zones:

- Central Standard Time - USA - Central Standard Time - Australia - Central Summer Time - Australia

Yes, you read that correctly Australia, apparently, uses CST for both "Standard" UTC+9.30 and "Summer" UTC+10.30.

Besides that. Do you want to accept their word for it if it's daylight savings time or not? They might enter EST or EDT for example? You would have to take responsibility for that in your application anyway.

dewdrops wrote: > My question is - is there a way to convert "PST" into the required > timezone name or at least get the UTC offset for it?

Well, actually there is no "safe" way to do that. Some time zones share the same abbreviation. For example CST has at least three matching time zones:

Also, how many ordinary know their time zone abbreviations ?

Fred

Frederick Cheung wrote: [...]

Also, how many ordinary know their time zone abbreviations ?

And how many time zones even have standard abbreviations? Just give the user a menu.

Fred

Best,

hmmm .. true but what if you are accepting an email from the user to set the task in your calendar app??

The only othe option is somehow get the 'email sender's' IP to place him in some timezone or Try to get the time from the email but all i got was the datetime of the email server they sent the email from (eg gmail etc).

Any suggestions on this issue??

dewdrops wrote:

hmmm .. true but what if you are accepting an email from the user to set the task in your calendar app??

The only othe option is somehow get the 'email sender's' IP to place him in some timezone or Try to get the time from the email but all i got was the datetime of the email server they sent the email from (eg gmail etc).

Any suggestions on this issue??

On Nov 11, 2:24�am, Marnen Laibow-Koser <rails-mailing-l...@andreas-

A possible solution is to ask your users what their local time zone is using the time zone select helper. Then store that value in their user record. Then assume all times are in the time zone that you store for them.

Dealing with time zones is not a trivial issue and you won't be able to rely on time zone names or abbreviations. As mentioned earlier, users will probably not even know what to enter anyway.

Interesting, although I find it hard to believe that any self respecting Aussie would use Central Summer Time, since the normal name is Central Daylight Time, and I'd suspect that "Summer Time" would be considered a Pommie afectation.

Most countries which use Summer instead of Daylight in TZ period abreviations seem to not use the lack of a letter, or an entirely different abbreviation for the winter time

GMT, and BST, or IST

CET, and CEST

etc.

but it's quite true that time zone period abbreviations can't in general be used to identify a particular time zone, even at a given period of time. Another complication being that such things tend to change with new governents, laws, and whims.

A good list of abbreviations can be found at: