Skip to content

Instantly share code, notes, and snippets.

@gregoryyoung
Created February 25, 2014 14:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gregoryyoung/9210402 to your computer and use it in GitHub Desktop.
Save gregoryyoung/9210402 to your computer and use it in GitHub Desktop.
var o =
JArray.Parse(@"[
{
""eventId"": ""fbf4a1a1-b4a3-4dfe-a01f-ec52c34e16e4"",
""eventType"": ""event-type"",
""data"": {
""BirthDate"": ""1987-11-07T00:00:00.000+01:00""
}
}
]");
var root = o[0]["data"];
Console.Write(root);
prints:
{
"BirthDate": "1987-11-07T01:00:00+02:00"
}
Note MS are gone!
@cyberzed
Copy link

What result do you get with .001 ms - correct output or?

@Vidarls
Copy link

Vidarls commented Feb 25, 2014

And also the timezone has changed..

@LodewijkSioen
Copy link

The default format used by Json.NET is the ISO 8601 standard: "2012-03-19T07:22Z". No microseconds there.

http://james.newtonking.com/json/help/index.html

@thefringeninja
Copy link

Doesn't matter, how should it know that is a date and not a string?

@melcloud
Copy link

ISO date doesn't support it. See comments at (moment/moment#248). Maybe a custom date parser helps?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment