DateTime.Parse(“2012-09-30T23:00:00.0000000Z”) always converts to DateTimeKind.Local

后端 未结 5 1389
猫巷女王i
猫巷女王i 2020-11-30 02:06

I want to parse a string that represent a DateTime in UTC format.

My string representation includes the Zulu time specification which should indicate that the string

5条回答
  •  清歌不尽
    2020-11-30 02:52

    Use the TimeZoneInfo class using the following:

    var myDate = TimeZoneInfo.ConvertTimeToUtc(DateTime.Parse("2012-09-30T23:00:00.0000000Z"));
    

提交回复
热议问题