TimeZone and daylight Saving time

Source: Internet
Author: User

Label:

A project in Western Europe, before taking time simple with DateTime.UtcNow.AddHours (1); Western Europe is in the 1th time zone.

It was correct until March, but both the EU countries and Switzerland implemented daylight saving time from the last Sunday of March to the last Sunday in October. Time changes were also made in 2:00 EU countries on the last Sunday of March GMT.

After April, it was one hours, which means that the time taken by Datetime.utcnow was not daylight saving.

So use the TimeZoneInfo class to solve the time zone problem. The following code can be used to compare the differences.

            DateTime Dtnow = DateTime.UtcNow.AddHours (1); Western European            Console.WriteLine ("Datetime.utcnow=" + DateTime.UtcNow.ToString ());            Console.WriteLine ("Dtnow=" + dtnow.tostring ());            DateTime dt = Timezoneinfo.converttimebysystemtimezoneid (                datetime.utcnow, "UTC", "W. Europe Standard Time");            Console.WriteLine ("TimeZone dt =" + dt. ToString ());

How does TimeZoneID know?

foreach (TimeZoneInfo TimeZoneInfo in Timezoneinfo.getsystemtimezones ()) {    Console.WriteLine ( Timezoneinfo.displayname);    Console.WriteLine (timezoneinfo.id);}

The results are as follows:

(utc-12:00) west of International Date Line
Dateline Standard Time

(UTC-11:00) International Standard Time-11
UTC-11

(utc-10:00) Hawaii
Hawaiian Standard Time

(UTC-09:00) Alaska
Alaskan Standard Time

(utc-08:00) Baja California
Pacific Standard Time (Mexico)

(utc-08:00) Pacific Time (US and Canada)
Pacific Standard Time

(utc-07:00) Arizona that
US Mountain Standard Time

(utc-07:00) Mountain Time (US and Canada)
Mountain Standard Time

(utc-07:00) Zishing Hua, La Paz, Puntland
Mountain Standard Time (Mexico)

(utc-06:00) Central America
Central America Standard Time

(utc-06:00) Central Time (US and Canada)
Central Standard Time

(utc-06:00) Guadalajara, Mexico City, Monterey
Central Standard Time (Mexico)

(utc-06:00) SA million (Canada)
Canada Central Standard Time

(utc-05:00) Indiana (east)
US Eastern Standard Time

(utc-05:00) Eastern Time (US and Canada)
Eastern Standard Time

(utc-05:00) Bogota, Lima, Quito
SA Pacific Standard Time

(UTC-04:30) Caracas
Venezuela Standard Time

(utc-04:00) Asuncion
Paraguay Standard Time

(utc-04:00) Georgetown, La Paz, Manaus, San Juan
SA Western Standard Time

(utc-04:00) Quaint bar
Central Brazilian Standard Time

(utc-04:00) Atlantic Time (Canada)
Atlantic Standard Time

(utc-04:00) Santiago
Pacific SA Standard Time

(utc-03:30) Newfoundland
Newfoundland Standard Time

(utc-03:00) Brasilia
E. South America Standard Time

(utc-03:00) Buenos Aires
Argentina Standard Time

(utc-03:00) Greenland
Greenland Standard Time

(utc-03:00) Monteverde
Montevideo Standard Time

(utc-03:00) El Salvador
Bahia Standard Time

(utc-03:00) Kering, Forta Lica
SA Eastern Standard Time

(UTC-02:00) International Standard Time-02
UTC-02

(utc-02:00) Central Atlantic
Mid-Atlantic Standard Time

(utc-01:00) Acores, Is. Dos
Azores Standard Time

(utc-01:00) Cape d ' Archipelago
Cape Verde Standard Time

(UTC) Casablanca
Morocco Standard Time

(UTC) International time
Utc

(UTC) Monrovia, Reykjavik
Greenwich Standard Time

(UTC) Dublin, Edinburgh, Lisbon, London
GMT Standard Time

(utc+01:00) Central West Africa
W. Africa Standard Time

(utc+01:00) Serrailley Buddha, Scopia, Warsaw, Greb
Central European Standard Time

(utc+01:00) Brussels, Copenhagen, Madrid, Paris
Romance Standard Time

(utc+01:00) Wintuck
Namibia Standard Time

(utc+01:00) Belgrade, Bratislava, Budapest, rubles, Prague
Central Europe Standard Time

(utc+01:00) Amsterdam, Berlin, Bern, Rome, Stockholm, Vienna
W. Europe Standard Time

(utc+02:00) Istanbul
Turkey Standard Time

(utc+02:00) Harare, phi-Tori
South Africa Standard Time

(utc+02:00) Damascus
Syria Standard Time

(utc+02:00) Eastern Europe
E. Europe Standard Time

(utc+02:00) Jerusalem
Israel Standard Time

(utc+02:00) Beirut
Middle East Standard Time

(utc+02:00) Helsinki, Keyev, Riga, Sufi, Tallinn, Vilnius
FLE Standard Time

(utc+02:00) Cairo
Egypt Standard Time

(utc+02:00) Athens, Bucharest
GTB Standard Time

(utc+03:00) Körigsberg, Minsk
Kaliningrad Standard Time

(utc+03:00) Nairobi
E. Africa Standard Time

(utc+03:00) Amman
Jordan Standard Time

(utc+03:00) Baghdad
Arabic Standard Time

(UTC+03:00) Kuwait, Riyadh
Arab Standard Time

(utc+03:30) Tehran
Iran Standard Time

(utc+04:00) Baku
Azerbaijan Standard Time

(utc+04:00) Tbilisi
Georgian Standard Time

(utc+04:00) Moscow, Saint Petersburg, Volgograd
Russian Standard Time

(utc+04:00) Lobes temperature
Caucasus Standard Time

(utc+04:00) Port Louis
Mauritius Standard Time

(utc+04:00) Abu Dhabi, Muscat
Arabian Standard Time

(utc+04:30) Kabul
Afghanistan Standard Time

(utc+05:00) Islamic Islamabad, Klotsche
Pakistan Standard Time

(utc+05:00) Tashkent
West Asia Standard Time

(utc+05:30) Sri Haja Noboribetsu
Sri Lanka Standard Time

(utc+05:30), Kolkata, Bangladesh, New Delhi
India Standard Time

(UTC+05:45) Kathmandu
Nepal Standard Time

(utc+06:00) Icatlin Fort
Ekaterinburg Standard Time

(utc+06:00) Dhaka
Bangladesh Standard Time

(utc+06:00) Astana
Central Asia Standard Time

(utc+06:30) Yangon
Myanmar Standard Time

(utc+07:00) Bangkok, Hanoi, Jakarta
SE Asia Standard Time

(utc+07:00) Normansbirsko
N. Central Asia Standard Time

(utc+08:00) Perth
W. Australiastandard Time

(utc+08:00) Krasnoyarsk
North Asia Standard Time

(utc+08:00) Beijing, Chongqing, Hong Kong, Urumqi
China Standard Time

(utc+08:00) Taipei
Taipei Standard Time

(utc+08:00) Kuala Lumpur, Singapore
Singapore Standard Time

(utc+08:00) Cullen
Ulaanbaatar Standard Time

(utc+09:00) Irkutsk
North Asia-East Standard Time

(utc+09:00) Osaka, Hokkaido, Tokyo
Tokyo Standard Time

(utc+09:00) Seoul
Korea Standard Time

(utc+09:30) Alands
Cen. Australiastandard Time

(UTC+09:30) Darwin
AUS Central Standard Time

(utc+10:00) Jakuzk
Yakutsk Standard Time

(utc+10:00) Canberra, Melbourne, Sydney
AUS Eastern Standard Time

(utc+10:00) Brisbane
E. australiastandard time

(utc+10:00) Guam, Port Moursbes
West Pacific Standard Time

(utc+10:00) Hobart
Tasmania Standard Time

(utc+11:00) Sea cucumber
Vladivostok Standard Time

(utc+11:00) Solomon Islands, New Caledonia Islands
Central Pacific Standard Time

(UTC+12:00) International Standard Time +12
Utc+12

(utc+12:00) Oakland, Wellington
New Zealand Standard Time

(utc+12:00) Peter Paulvsk-Kamchatka-obsolete
Kamchatka Standard Time

(utc+12:00) Fiji
Fiji Standard Time

(utc+12:00) Magadan
Magadan Standard Time

(utc+13:00) Nuba Lou FA
Tonga Standard Time

(utc+13:00) Samoa
Samoa Standard Time

TimeZone and daylight Saving time

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

Tags Index: