序列化JSON时时间类型处理-IsoDateTimeConverter
public static string MyEncode(object o)
{
if (o == null || o.ToString() == "null") return null;
if (o != null && (o.GetType() == typeof(String) || o.GetType() == typeof(string)))
{
return o.ToString();
}
IsoDateTimeConverter dt = new IsoDateTimeConverter();
dt.DateTimeFormat ="yyyy'-'MM'-'dd'T'HH':'mm':'ss";
return JsonConvert.SerializeObject(o, dt);
}

浙公网安备 33010602011771号