I'm experimenting/learning with java and json. I'm trying to make my own data for a json parser and I can't figure out what datatype the example data it gives me is. I think it's a datetime, but I don't know how to get my date (regular format) to the json date format. I'm coding the example using PHP.
Jsonp Example Data:
[1110844800000,178.61],
[1110931200000,175.60],
[1111017600000,179.29],
My Date and Data format:
2012-03-01 18:21:31,42
2012-03-01 18:22:31,46
2012-03-02 18:21:31,40
Does anyone know if the 13 digit date/time json above is a datetime specific to java or json? And if so, how to get my data to that format?
Thanks!
It looks like the Javascript version of Unix time, which is really just Unix time in milliseconds rather than seconds.
Divide your 13-digit numbers by 1000 and run them through this site to verify: http://www.onlineconversion.com/unix_time.htm
Each of what you've quoted is an array with two entries. The first entry in each array might be a datetime. If so:
1110844800000 = Tue, 15 Mar 2005 00:00:00 GMT 1110931200000 = Wed, 16 Mar 2005 00:00:00 GMT 1111017600000 = Thu, 17 Mar 2005 00:00:00 GMT
JavaScript stores date/times as milliseconds since The Epoch (midnight on 1 Jan 1970 GMT), so to convert to Date
instances:
var dt = new Date(1110844800000);
...which is how I got the values above.
No idea what the second entry in each array is. It looks like a currency (money) figure.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With