I've been given some data to create some chart graphics and the dates are in a format I don't recognise. If I knew the format name I could easily look them up but initial search has drawn a blank. Example below..
[1126051200000, 29.9], '7th Sep 2005 [1126137600000, 71.5], '8th Sep 2005 [1126224000000, 106.4], '9th Sep 2005 [1126483200000, 129.2], '12th Sep 2005 [1126569600000, 144.0], '13th Sep 2005 [1126656000000, 176.0] '14th Sep 2005I've added the dates I know as comments but what format are these dates in? Eg how is 1126051200000 = 7th Sep 2005?
I suspect the 00000 padding is time but not used?
1 Answer
They are Unix Epoch millisecond date/time stamps. Here is one converter or you could always write your own. Basically it is the number of milliseconds since 1/1/1970 not counting leap seconds.
Assuming you have a UNIX shell handy, they can be converted to any format using the date tool with the argument --date=${epoch_time}, for example:
$ date --date=@1126051200.000
Wed Sep 7 02:00:00 CEST 2005
$ date --date=@1126051200.000 -u
Wed Sep 7 00:00:00 UTC 2005
$ date --date=@1126051200.000 -u -Ins
2005-09-07T00:00:00,000000000+0000
$ date --date=@1126051200.000 -u "+'%-dth %b %Y"
'7th Sep 2005Inversely, you could use something like:
$ date --date="7 Sep 2005" -u "+%s%3N"
1126051200000 7