How to add timezone offset to JSON.NET serialization?

后端 未结 2 1393
天命终不由人
天命终不由人 2020-12-09 05:38

My DateTimePicker is bound to property:

    picker.DataBindings.Add(\"Value\", this, \"EventDate\");
    ...
    private DateTime eventDate;
    public DateT         


        
2条回答
  •  难免孤独
    2020-12-09 06:23

    I use this.

    It works very well.

    JsonConvert.SerializeObject(object, new JsonSerializerSettings()
    {
        DateFormatHandling = DateFormatHandling.IsoDateFormat,
        DateTimeZoneHandling = DateTimeZoneHandling.Local
    });
    

提交回复
热议问题