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

后端 未结 5 2131
一个人的身影
一个人的身影 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:17

    Simplest solution: First parse string to local DateTime, use any parse method then call

    new DateTimeOffset(dateTimeLocal.Ticks, timezone.BaseUtcOffset)
    

提交回复
热议问题