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

matlab - How to equate a structure array to structure array -

c# - Operator '==' incompatible with operand types 'Guid' and 'Guid' using DynamicExpression.ParseLambda<T, bool> -