keep C# datetime local time between json and Web api?

前端 未结 3 1887
死守一世寂寞
死守一世寂寞 2021-02-05 12:55

I have problem when I have datatime in json object it will convert it to UTC time zone in C# dateTime just want to ask how to keep local time?can I set time zone property in w

3条回答
  •  暗喜
    暗喜 (楼主)
    2021-02-05 13:00

    You can use TimeZoneInfo.ConvertTime to convert to the wanted timezone.

    Checkout this method: https://msdn.microsoft.com/en-us/library/bb382770(v=vs.110).aspx

提交回复
热议问题