Parse a date string into a certain timezone (supporting daylight saving time)

后端 未结 5 2135
一个人的身影
一个人的身影 2020-12-05 23:48

Ok i\'ve been working very hard the last few weeks and i\'ve come across a small problem. I don\'t think my mind is quite up to the task right now :) so i need some tips/hel

5条回答
  •  刺人心
    刺人心 (楼主)
    2020-12-06 00:09

    TimeZoneInfo has a static method ConvertTimeToUtc which enables you to specify the datetime and timezone. This will to do the time adjustment for you, and return the UTC date.

    MSDN documentation is http://msdn.microsoft.com/en-us/library/bb495915.aspx, complete with example.

提交回复
热议问题