| 12345678910111213141516171819202122232425262728293031 |
- using System;
- using System.Collections.Generic;
- using System.IO;
- using System.Text;
- using System.Web.Script.Serialization;
- public class CustomJsonConverter : JavaScriptConverter
- {
- public override IEnumerable<Type> SupportedTypes
- {
- get { return new[] { typeof(DateTime) }; }
- }
- public override IDictionary<string, object> Serialize(object obj, JavaScriptSerializer serializer)
- {
- var result = new Dictionary<string, object>();
- if (obj is DateTime)
- {
- var date = (DateTime)obj;
- result[""] = date.ToString("yyyy-MM-dd HH:mm:ss");
- }
- return result;
- }
- public override object Deserialize(IDictionary<string, object> dictionary, Type type, JavaScriptSerializer serializer)
- {
- throw new NotImplementedException();
- }
- }
|