TimeZoneInfo.ConvertTimeToUtc(new DateTime(2006, fromDate.Month, fromDate.Day),TimeZoneInfo.Local)
{7/24/2006 **4:00:00 AM**}
Date: {7/24/2006 12:00:00 AM}
Day: 24
DayOfWeek: Monday
DayOfYear: 205
Hour: 4
Kind: Utc
Millisecond: 0
Minute: 0
Month: 7
Second: 0
Ticks: 632893104000000000
TimeOfDay: {04:00:00}
Year: 2006
TimeZoneInfo.ConvertTimeToUtc(new DateTime(2005, fromDate.Month, fromDate.Day),TimeZoneInfo.Local)
{7/24/2005 **5:00:00 AM**}
Date: {7/24/2005 12:00:00 AM}
Day: 24
DayOfWeek: Sunday
DayOfYear: 205
Hour: 5
Kind: Utc
Millisecond: 0
Minute: 0
Month: 7
Second: 0
Ticks: 632577780000000000
TimeOfDay: {05:00:00}
Year: 2005
答案 0 :(得分:1)
问题在于我将我的机器设置为东部(印第安纳州)而不是东部。 2005年,他们没有观察印第安纳州的DST(http://www.timeanddate.com/time/us/indiana-time.html),他们在2006年采用了DST。将我的机器切换回东部时区解决了这个问题。