在使用Newtonsoft.Json時會遇到這樣的問題,數據庫存的值跟接收到反序列的值差了8個小時。這時,只要在反序列化時設置一下就能夠了。數據庫
JsonConvert.DeserializeObject<T>(jsonStr, new JsonSerializerSettings { DateTimeZoneHandling = DateTimeZoneHandling.Local });