New to Json / Java - what datatype? Time? 13 digits. Using PHP

I am experimenting / participating in java and json. I am trying to make my own json parsing data and I cannot figure out which data type is the example it gives me. I think it is a date, but I dont know how to get the date (normal format) in json date format. I am coding an example using PHP.

Jsonp example data:



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 json date / time above is the time specific to java or json? And if so, how do I get my data in this format?



source to share

4 answers

Seems like the Javascript version of Unix time , which is actually just Unix time in milliseconds, not seconds.

Divide your 13 digit numbers by 1000 and run them through this site to check:



Each of the quoted data is an array with two entries. The first entry in each array can be a date and time. If yes:

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 has been storing date / time in milliseconds since Epoch (midnight January 1, 1970 GMT), so to convert to instances Date


var dt = new Date(1110844800000);


... this is how I got the values ​​above.

Don't know what is the second entry in each array. It looks like a number (money).



'- 1110844800000 is the number of milliseconds since January 1, 1970, and "-178.61" is the time offset.



Your first array is Unix Time in milliseconds as gregheo said.

If you want to convert your Unix timestamp to JAVA you can find a good example:

Convert UNIX timestamp to DT



All Articles