Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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 2005

I'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?

share|improve this question
up vote 6 down vote accepted

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
$ date --date=@1126051200.000 -u "+'%-dth %b %Y"
'7th Sep 2005

Inversely, you could use something like:

$ date --date="7 Sep 2005" -u "+%s%3N"
share|improve this answer
Seconds, not milliseconds. – Ansgar Wiechers Sep 11 '12 at 0:41
Ooops, how right you are – EBGreen Sep 11 '12 at 13:54
No, they are most certainly milliseconds. – Eroen Sep 11 '12 at 13:57
I think the confusion comes from the fact that the time stamps in the question are Epoch milliseconds while the standard definition of Epoch Time is seconds. – EBGreen Sep 11 '12 at 14:11
I agree, while adding that the epoch timestamp is often accompanied by a us or ns timestamp in the same struct or similar. I think the first version of the answer fits the question better (as in not wrong), though. Sorry about going overboard with examples, I didn't mean to, but I'm done now. – Eroen Sep 11 '12 at 14:25

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .