K
ken
Anyone knows whether C# has bug about DST, if so, whether MS has
provided fix about it, and how? Thanks very much.
I set my timezone of my laptop to UTC +02:00 Jerusalem and check the
option - "automatically adjust clock for DST".
From http://www.timeanddate.com/worldclock/timezone.html?n=110&syear=2010,
we can see that at 2010-03-26 02:00, Jerusalem began to use DST and
changed timezone from UTC+2 to UTC+3.
I write a program to verify my guess: C# still uses UTC+2 for
Jerusalem until 04/01, and begin to use DST for Jerusalem (UTC+3) from
04/02.
System.DateTime givenDate = Convert.ToDateTime("03/24/2010 08:00");
givenDate = DateTime.SpecifyKind(givenDate, DateTimeKind.Local);
Console.WriteLine(givenDate.ToUniversalTime());
givenDate = Convert.ToDateTime("03/26/2010 08:00");
givenDate = DateTime.SpecifyKind(givenDate, DateTimeKind.Local);
Console.WriteLine(givenDate.ToUniversalTime());
givenDate = Convert.ToDateTime("04/01/2010 08:00");
givenDate = DateTime.SpecifyKind(givenDate, DateTimeKind.Local);
Console.WriteLine(givenDate.ToUniversalTime());
givenDate = Convert.ToDateTime("04/02/2010 08:00");
givenDate = DateTime.SpecifyKind(givenDate, DateTimeKind.Local);
Console.WriteLine(givenDate.ToUniversalTime());
3/24/2010 6:00:00 AM
3/26/2010 6:00:00 AM
4/1/2010 6:00:00 AM ===> C# still use UTC+2 for Jerusalem.
4/2/2010 5:00:00 AM ===> from 4/2 on, C# begin to use DST for
Jerusalem, changed to UTC+3
Anyone knows whether this is a C# bug, if so, how to fix it?
Thanks
provided fix about it, and how? Thanks very much.
I set my timezone of my laptop to UTC +02:00 Jerusalem and check the
option - "automatically adjust clock for DST".
From http://www.timeanddate.com/worldclock/timezone.html?n=110&syear=2010,
we can see that at 2010-03-26 02:00, Jerusalem began to use DST and
changed timezone from UTC+2 to UTC+3.
I write a program to verify my guess: C# still uses UTC+2 for
Jerusalem until 04/01, and begin to use DST for Jerusalem (UTC+3) from
04/02.
System.DateTime givenDate = Convert.ToDateTime("03/24/2010 08:00");
givenDate = DateTime.SpecifyKind(givenDate, DateTimeKind.Local);
Console.WriteLine(givenDate.ToUniversalTime());
givenDate = Convert.ToDateTime("03/26/2010 08:00");
givenDate = DateTime.SpecifyKind(givenDate, DateTimeKind.Local);
Console.WriteLine(givenDate.ToUniversalTime());
givenDate = Convert.ToDateTime("04/01/2010 08:00");
givenDate = DateTime.SpecifyKind(givenDate, DateTimeKind.Local);
Console.WriteLine(givenDate.ToUniversalTime());
givenDate = Convert.ToDateTime("04/02/2010 08:00");
givenDate = DateTime.SpecifyKind(givenDate, DateTimeKind.Local);
Console.WriteLine(givenDate.ToUniversalTime());
3/24/2010 6:00:00 AM
3/26/2010 6:00:00 AM
4/1/2010 6:00:00 AM ===> C# still use UTC+2 for Jerusalem.
4/2/2010 5:00:00 AM ===> from 4/2 on, C# begin to use DST for
Jerusalem, changed to UTC+3
Anyone knows whether this is a C# bug, if so, how to fix it?
Thanks