Newtonsoft.Json 時區差解決方法

在使用Newtonsoft.Json時會遇到這樣的問題,數據庫存的值跟接收到反序列的值差了8個小時。這時,只要在反序列化時設置一下就能夠了。數據庫

JsonConvert.DeserializeObject<T>(jsonStr, new JsonSerializerSettings
            {
                DateTimeZoneHandling = DateTimeZoneHandling.Local
            });
相關文章
相關標籤/搜索