views:

96

answers:

1

Edit

I believe this is a issue with I am using windows 7 and my server is windows 2008. I think windows 2008 uses still GMT. So how could I get around this issue. Like I want to deal in UTC but I want to have the default selected item to be "Coordinated Universal Time" what is not in the gmt list but in the UTC list.

So I am not sure what to do. (I am not a shared host so if you can change it on windows 2008 machine it won't help me much).

Hi

I have this line to get all the timezones

 Dictionary<string, TimeZoneInfo> storeZoneName = TimeZoneInfo.GetSystemTimeZones().ToDictionary(z => z.DisplayName);

Now when I upload I try it on my local machine I get this

(UTC-12:00) International Date Line West
(UTC-11:00) Coordinated Universal Time-11
(UTC-11:00) Samoa
(UTC-10:00) Hawaii
(UTC-09:00) Alaska
(UTC-08:00) Baja California
(UTC-08:00) Pacific Time (US & Canada)
(UTC-07:00) Arizona
(UTC-07:00) Chihuahua, La Paz, Mazatlan
(UTC-07:00) Mountain Time (US & Canada)
(UTC-06:00) Central America
(UTC-06:00) Central Time (US & Canada)
(UTC-06:00) Guadalajara, Mexico City, Monterrey
(UTC-06:00) Saskatchewan
(UTC-05:00) Bogota, Lima, Quito
(UTC-05:00) Eastern Time (US & Canada)
(UTC-05:00) Indiana (East)
(UTC-04:30) Caracas
(UTC-04:00) Asuncion
(UTC-04:00) Atlantic Time (Canada)
(UTC-04:00) Cuiaba
(UTC-04:00) Georgetown, La Paz, Manaus, San Juan
(UTC-04:00) Santiago
(UTC-03:30) Newfoundland
(UTC-03:00) Brasilia
(UTC-03:00) Buenos Aires
(UTC-03:00) Cayenne, Fortaleza
(UTC-03:00) Greenland
(UTC-03:00) Montevideo
(UTC-02:00) Coordinated Universal Time-02
(UTC-02:00) Mid-Atlantic
(UTC-01:00) Azores
(UTC-01:00) Cape Verde Is.
(UTC) Casablanca
(UTC) Coordinated Universal Time
(UTC) Dublin, Edinburgh, Lisbon, London
(UTC) Monrovia, Reykjavik
(UTC+01:00) Amsterdam, Berlin, Bern, Rome, Stockholm, Vienna
(UTC+01:00) Belgrade, Bratislava, Budapest, Ljubljana, Prague
(UTC+01:00) Brussels, Copenhagen, Madrid, Paris
(UTC+01:00) Sarajevo, Skopje, Warsaw, Zagreb
(UTC+01:00) West Central Africa
(UTC+02:00) Amman
(UTC+02:00) Athens, Bucharest, Istanbul
(UTC+02:00) Beirut
(UTC+02:00) Cairo
(UTC+02:00) Harare, Pretoria
(UTC+02:00) Helsinki, Kyiv, Riga, Sofia, Tallinn, Vilnius
(UTC+02:00) Jerusalem
(UTC+02:00) Minsk
(UTC+02:00) Windhoek
(UTC+03:00) Baghdad
(UTC+03:00) Kuwait, Riyadh
(UTC+03:00) Moscow, St. Petersburg, Volgograd
(UTC+03:00) Nairobi
(UTC+03:30) Tehran
(UTC+04:00) Abu Dhabi, Muscat
(UTC+04:00) Baku
(UTC+04:00) Port Louis
(UTC+04:00) Tbilisi
(UTC+04:00) Yerevan
(UTC+04:30) Kabul
(UTC+05:00) Ekaterinburg
(UTC+05:00) Islamabad, Karachi
(UTC+05:00) Tashkent
(UTC+05:30) Chennai, Kolkata, Mumbai, New Delhi
(UTC+05:30) Sri Jayawardenepura
(UTC+05:45) Kathmandu
(UTC+06:00) Astana
(UTC+06:00) Dhaka
(UTC+06:00) Novosibirsk
(UTC+06:30) Yangon (Rangoon)
(UTC+07:00) Bangkok, Hanoi, Jakarta
(UTC+07:00) Krasnoyarsk
(UTC+08:00) Beijing, Chongqing, Hong Kong, Urumqi
(UTC+08:00) Irkutsk
(UTC+08:00) Kuala Lumpur, Singapore
(UTC+08:00) Perth
(UTC+08:00) Taipei
(UTC+08:00) Ulaanbaatar
(UTC+09:00) Osaka, Sapporo, Tokyo
(UTC+09:00) Seoul
(UTC+09:00) Yakutsk
(UTC+09:30) Adelaide
(UTC+09:30) Darwin
(UTC+10:00) Brisbane
(UTC+10:00) Canberra, Melbourne, Sydney
(UTC+10:00) Guam, Port Moresby
(UTC+10:00) Hobart
(UTC+10:00) Vladivostok
(UTC+11:00) Magadan, Solomon Is., New Caledonia
(UTC+12:00) Auckland, Wellington
(UTC+12:00) Coordinated Universal Time+12
(UTC+12:00) Fiji
(UTC+12:00) Petropavlovsk-Kamchatsky
(UTC+13:00) Nuku'alofa

When I run it on a different local machine or my server I have this.

<option value="(GMT) Casablanca">(GMT) Casablanca</option>
<option value="(GMT) Greenwich Mean Time : Dublin, Edinburgh, Lisbon, London">(GMT) Greenwich Mean Time : Dublin, Edinburgh, Lisbon, London</option>
<option value="(GMT) Monrovia, Reykjavik">(GMT) Monrovia, Reykjavik</option>
<option value="(GMT+01:00) Amsterdam, Berlin, Bern, Rome, Stockholm, Vienna">(GMT+01:00) Amsterdam, Berlin, Bern, Rome, Stockholm, Vienna</option>
<option value="(GMT+01:00) Belgrade, Bratislava, Budapest, Ljubljana, Prague">(GMT+01:00) Belgrade, Bratislava, Budapest, Ljubljana, Prague</option>
<option value="(GMT+01:00) Brussels, Copenhagen, Madrid, Paris">(GMT+01:00) Brussels, Copenhagen, Madrid, Paris</option>
<option value="(GMT+01:00) Sarajevo, Skopje, Warsaw, Zagreb">(GMT+01:00) Sarajevo, Skopje, Warsaw, Zagreb</option>
<option value="(GMT+01:00) West Central Africa">(GMT+01:00) West Central Africa</option>
<option value="(GMT+02:00) Amman">(GMT+02:00) Amman</option>
<option value="(GMT+02:00) Athens, Bucharest, Istanbul">(GMT+02:00) Athens, Bucharest, Istanbul</option>
<option value="(GMT+02:00) Beirut">(GMT+02:00) Beirut</option>
<option value="(GMT+02:00) Cairo">(GMT+02:00) Cairo</option>
<option value="(GMT+02:00) Harare, Pretoria">(GMT+02:00) Harare, Pretoria</option>
<option value="(GMT+02:00) Helsinki, Kyiv, Riga, Sofia, Tallinn, Vilnius">(GMT+02:00) Helsinki, Kyiv, Riga, Sofia, Tallinn, Vilnius</option>
<option value="(GMT+02:00) Jerusalem">(GMT+02:00) Jerusalem</option>
<option value="(GMT+02:00) Minsk">(GMT+02:00) Minsk</option>
<option value="(GMT+02:00) Windhoek">(GMT+02:00) Windhoek</option>
<option value="(GMT+03:00) Baghdad">(GMT+03:00) Baghdad</option>
<option value="(GMT+03:00) Kuwait, Riyadh">(GMT+03:00) Kuwait, Riyadh</option>
<option value="(GMT+03:00) Moscow, St. Petersburg, Volgograd">(GMT+03:00) Moscow, St. Petersburg, Volgograd</option>
<option value="(GMT+03:00) Nairobi">(GMT+03:00) Nairobi</option>
<option value="(GMT+03:00) Tbilisi">(GMT+03:00) Tbilisi</option>
<option value="(GMT+03:30) Tehran">(GMT+03:30) Tehran</option>
<option value="(GMT+04:00) Abu Dhabi, Muscat">(GMT+04:00) Abu Dhabi, Muscat</option>
<option value="(GMT+04:00) Baku">(GMT+04:00) Baku</option>
<option value="(GMT+04:00) Port Louis">(GMT+04:00) Port Louis</option>
<option value="(GMT+04:00) Yerevan">(GMT+04:00) Yerevan</option>
<option value="(GMT+04:30) Kabul">(GMT+04:30) Kabul</option>
<option value="(GMT+05:00) Ekaterinburg">(GMT+05:00) Ekaterinburg</option>
<option value="(GMT+05:00) Islamabad, Karachi">(GMT+05:00) Islamabad, Karachi</option>
<option value="(GMT+05:00) Tashkent">(GMT+05:00) Tashkent</option>
<option value="(GMT+05:30) Chennai, Kolkata, Mumbai, New Delhi">(GMT+05:30) Chennai, Kolkata, Mumbai, New Delhi</option>
<option value="(GMT+05:30) Sri Jayawardenepura">(GMT+05:30) Sri Jayawardenepura</option>
<option value="(GMT+05:45) Kathmandu">(GMT+05:45) Kathmandu</option>
<option value="(GMT+06:00) Almaty, Novosibirsk">(GMT+06:00) Almaty, Novosibirsk</option>
<option value="(GMT+06:00) Astana, Dhaka">(GMT+06:00) Astana, Dhaka</option>
<option value="(GMT+06:30) Yangon (Rangoon)">(GMT+06:30) Yangon (Rangoon)</option>
<option value="(GMT+07:00) Bangkok, Hanoi, Jakarta">(GMT+07:00) Bangkok, Hanoi, Jakarta</option>
<option value="(GMT+07:00) Krasnoyarsk">(GMT+07:00) Krasnoyarsk</option>
<option value="(GMT+08:00) Beijing, Chongqing, Hong Kong, Urumqi">(GMT+08:00) Beijing, Chongqing, Hong Kong, Urumqi</option>
<option value="(GMT+08:00) Irkutsk, Ulaan Bataar">(GMT+08:00) Irkutsk, Ulaan Bataar</option>
<option value="(GMT+08:00) Kuala Lumpur, Singapore">(GMT+08:00) Kuala Lumpur, Singapore</option>
<option value="(GMT+08:00) Perth">(GMT+08:00) Perth</option>
<option value="(GMT+08:00) Taipei">(GMT+08:00) Taipei</option>
<option value="(GMT+09:00) Osaka, Sapporo, Tokyo">(GMT+09:00) Osaka, Sapporo, Tokyo</option>
<option value="(GMT+09:00) Seoul">(GMT+09:00) Seoul</option>
<option value="(GMT+09:00) Yakutsk">(GMT+09:00) Yakutsk</option>
<option value="(GMT+09:30) Adelaide">(GMT+09:30) Adelaide</option>
<option value="(GMT+09:30) Darwin">(GMT+09:30) Darwin</option>
<option value="(GMT+10:00) Brisbane">(GMT+10:00) Brisbane</option>
<option value="(GMT+10:00) Canberra, Melbourne, Sydney">(GMT+10:00) Canberra, Melbourne, Sydney</option>
<option value="(GMT+10:00) Guam, Port Moresby">(GMT+10:00) Guam, Port Moresby</option>
<option value="(GMT+10:00) Hobart">(GMT+10:00) Hobart</option>
<option value="(GMT+10:00) Vladivostok">(GMT+10:00) Vladivostok</option>
<option value="(GMT+11:00) Magadan, Solomon Is., New Caledonia">(GMT+11:00) Magadan, Solomon Is., New Caledonia</option>
<option value="(GMT+12:00) Auckland, Wellington">(GMT+12:00) Auckland, Wellington</option>
<option value="(GMT+12:00) Fiji, Kamchatka, Marshall Is.">(GMT+12:00) Fiji, Kamchatka, Marshall Is.</option>
<option value="(GMT+13:00) Nuku'alofa">(GMT+13:00) Nuku'alofa</option>
<option value="(GMT-01:00) Azores">(GMT-01:00) Azores</option>
<option value="(GMT-01:00) Cape Verde Is.">(GMT-01:00) Cape Verde Is.</option>
<option value="(GMT-02:00) Mid-Atlantic">(GMT-02:00) Mid-Atlantic</option>
<option value="(GMT-03:00) Brasilia">(GMT-03:00) Brasilia</option>
<option value="(GMT-03:00) Buenos Aires">(GMT-03:00) Buenos Aires</option>
<option value="(GMT-03:00) Georgetown">(GMT-03:00) Georgetown</option>
<option value="(GMT-03:00) Greenland">(GMT-03:00) Greenland</option>
<option value="(GMT-03:00) Montevideo">(GMT-03:00) Montevideo</option>
<option value="(GMT-03:30) Newfoundland">(GMT-03:30) Newfoundland</option>
<option value="(GMT-04:00) Atlantic Time (Canada)">(GMT-04:00) Atlantic Time (Canada)</option>
<option value="(GMT-04:00) La Paz">(GMT-04:00) La Paz</option>
<option value="(GMT-04:00) Manaus">(GMT-04:00) Manaus</option>
<option value="(GMT-04:00) Santiago">(GMT-04:00) Santiago</option>
<option value="(GMT-04:30) Caracas">(GMT-04:30) Caracas</option>
<option value="(GMT-05:00) Bogota, Lima, Quito, Rio Branco">(GMT-05:00) Bogota, Lima, Quito, Rio Branco</option>
<option value="(GMT-05:00) Eastern Time (US &amp; Canada)">(GMT-05:00) Eastern Time (US &amp; Canada)</option>
<option value="(GMT-05:00) Indiana (East)">(GMT-05:00) Indiana (East)</option>
<option value="(GMT-06:00) Central America">(GMT-06:00) Central America</option>
<option value="(GMT-06:00) Central Time (US &amp; Canada)">(GMT-06:00) Central Time (US &amp; Canada)</option>
<option value="(GMT-06:00) Guadalajara, Mexico City, Monterrey">(GMT-06:00) Guadalajara, Mexico City, Monterrey</option>
<option value="(GMT-06:00) Saskatchewan">(GMT-06:00) Saskatchewan</option>
<option value="(GMT-07:00) Arizona">(GMT-07:00) Arizona</option>
<option value="(GMT-07:00) Chihuahua, La Paz, Mazatlan">(GMT-07:00) Chihuahua, La Paz, Mazatlan</option>
<option value="(GMT-07:00) Mountain Time (US &amp; Canada)">(GMT-07:00) Mountain Time (US &amp; Canada)</option>
<option value="(GMT-08:00) Pacific Time (US &amp; Canada)">(GMT-08:00) Pacific Time (US &amp; Canada)</option>
<option value="(GMT-08:00) Tijuana, Baja California">(GMT-08:00) Tijuana, Baja California</option>
<option value="(GMT-09:00) Alaska">(GMT-09:00) Alaska</option>
<option value="(GMT-10:00) Hawaii">(GMT-10:00) Hawaii</option>
<option value="(GMT-11:00) Midway Island, Samoa">(GMT-11:00) Midway Island, Samoa</option>
<option value="(GMT-12:00) International Date Line West">(GMT-12:00) International Date Line West</option>

They are different. Same line of code but one is GMT and one is UTC. How can I force it to be always the same?

Also I want to have a default choice of "UTC" but I am not sure what the diff is between this

(UTC-11:00) Coordinated Universal Time-11

and this

  (UTC-02:00) Coordinated Universal Time-02
+1  A: 

GMT and UTC are the same thing. I guess one system is set to English (US) and one to English (UK) (or some other combination, perhaps).

(UTC-11:00) Coordinated Universal Time-11

This means "11 hours behind UTC".

(UTC-02:00) Coordinated Universal Time-02

This means "2 hours behind UTC"

That is to say, if UTC is 4:32 PM, then UTC-02:00 would be 2:32 PM and UTC-11:00 would be 5:32 AM.

Dean Harding
Hmm. So how would I display straight UTC? Also how can I force it since they maybe the same thing but the names are different and that is enough to make it confusing.
chobo2
I think you can just to a string.Replace to change "UTC" to "GMT" (or vise versa). Standard UTC would just "(UTC) Coordinated Universal Time".
Dean Harding
LoL I did not see that in the list. I was looking for it. I think this is a windows 7 thing and I guess windows server 2008 does not do that sort of thing. Kinda annoying and I don't want to do a replace since like its not just those 3 letter changing it is the whole display name.
chobo2
Hmm it concerns me though if I host it on a 2008 server I want the first one to be Coordinated Universial Time but that is not on the GMT list. So what would happen then?
chobo2
I believe on the GMT list it would "(GMT) Greenwich Mean Time". Did you check your regional settings to make sure they're the same?
Dean Harding
I am not sure how to check. It still brings up a problem. Like I am using asp.net mvc and if I save a timezone while testing on my local machine the next time you should come to check your timezone setting that timezone should be selected. This works until I go to my hosted server and try it will be blank because the list it is generates is GMT and it has different names. So it never matches up the names.... It sucks when they change things mid game and every things like windows 2008 what is pretty new do it differently then windows 7 what is a bit newer.
chobo2
*OOOOoooh* now I see the problem! If you're storing the time zone for display later on, you should be using the `Id` property, not the `DisplayName` property. That way, it doesn't matter if the display name changes, the Id will always be the same. Alternatively, use `ToSerializedString` and `FromSerializedString` if you want make sure they're *exactly* the same no matter what.
Dean Harding
I find display name is alot better to use well to display the name as you get the offset as well plus sometimes it lists more location. I don't get how the ToSerializedString() would help if 2 different display names would be serialized I would think they would look different.
chobo2
Yes, you can *display* the "display name" but *store* the Id. That way, it doesn't really matter if it displays as "GMT" on one computer and "UTC" on another.
Dean Harding
Ya I see what you mean now. I just store the id and in the dropdown list I display the display name for the option but the value sent to the server is the id.
chobo2