A
AussieGuy
Guest
Hi,
I've been experimenting with the DateTime deserialization and have some strange behaviour.
Using this code:
DataContractJsonSerializer dcjs = new DataContractJsonSerializer(typeof(DateTime));
DateTime dateTime = new DateTime(1970, 1, 1, 0, 0, 0, 0).ToUniversalTime();
dcjs.WriteObject(Response.OutputStream, dateTime);
I would be expecting the response to be:
\/Date(0)\/
but am actually getting
\/Date(-39600000)\/
Am I missing something here? According to this article An Introduction to JavaScript Object Notation (JSON) in JavaScript and .NET it's meant to be the ticks since 1/1/1970.
Even the example given - "A date and time in UTC like November 29, 1989, 4:55:30 AM would be written out as "@62831853071@.", using this calculator Epoch Converter - Unix Timestamp Converter does not work.
Thanks for your help in advance.
AussieGuy
Continue reading...
I've been experimenting with the DateTime deserialization and have some strange behaviour.
Using this code:
DataContractJsonSerializer dcjs = new DataContractJsonSerializer(typeof(DateTime));
DateTime dateTime = new DateTime(1970, 1, 1, 0, 0, 0, 0).ToUniversalTime();
dcjs.WriteObject(Response.OutputStream, dateTime);
I would be expecting the response to be:
\/Date(0)\/
but am actually getting
\/Date(-39600000)\/
Am I missing something here? According to this article An Introduction to JavaScript Object Notation (JSON) in JavaScript and .NET it's meant to be the ticks since 1/1/1970.
Even the example given - "A date and time in UTC like November 29, 1989, 4:55:30 AM would be written out as "@62831853071@.", using this calculator Epoch Converter - Unix Timestamp Converter does not work.
Thanks for your help in advance.
AussieGuy
Continue reading...