C# Json.NET WCF Rest DateTime Format -


take @ following example code, output wcf date format "/date(1237951967000)/" or time zone variant.

class program {     public class test     {         public datetime date { get; set; }     }      static void main(string[] args)     {         var test = new test             {                 date = datetime.now             };           var json = jsonconvert.serializeobject(test);           console.writeline(json);     } } 

here output:

{"date":"2013-05-09t11:17:38.7990259-07:00"} 

how can adjust above code give desired format?

{"date":"\/date(1237951967000)\/"} 

var settings = new jsonserializersettings() {dateformathandling= dateformathandling.microsoftdateformat}; var json = jsonconvert.serializeobject(test, settings); 

Comments

Popular posts from this blog

linux - xterm copying to CLIPBOARD using copy-selection causes automatic updating of CLIPBOARD upon mouse selection -

c++ - qgraphicsview horizontal scrolling always has a vertical delta -