News for hackers. Stuff that matters.
Re:Lessons of JSON by ender7 on Monday April 30, 2012 @01:32PM (#3910286)
Why not just use Unix time (in milliseconds) for your timestamps? You'll have to convert it to whatever your desired container format is on the other end of the wire, but...you're going to have to do that for all of your other data as well.
Re:Lessons of JSON by olavk on Monday April 30, 2012 @03:10PM (#3910866)
Sure. Or you can use one of the ISO 8601 date formats encoded as a string. Or the special string "\/Date(...)\/" which some JSON libraries have chosen. The problem is not to encode a date, the problem is there is no agreed way to do it, so you can't be sure that the other end actually receive a date.
Re:Lessons of JSON by ominous_prime on Monday April 30, 2012 @02:11PM (#3910491)
It would be ambiguous, since you need to know what timezone the timestamp is from. This is why most applications use ISO8601.
Re:Lessons of JSON by Cushman on Monday April 30, 2012 @02:16PM (#3910521)
Unix time is always UTC, isn't it?
Re:Lessons of JSON by ominous_prime on Monday April 30, 2012 @02:35PM (#3910640)
Yeah, it is. I was thinking that since it just a raw number of seconds with no TZ designation, that there's too much room for incorrect implementations using localtime.