Fernando Ferrari
Fernando Ferrari

Reputation: 586

Flot shows wrong date from unix

i have a flot chart that should display two dates in its tooltips. I have those two unix times,

        [data] => 2013-04-17
        [unix] => 1366167600

and

        [data] => 2013-04-18
        [unix] => 1366254000

As you can see, they represent the dates 2013-04-17 and 2013-04-18.

My graph are plotted well, but its tooltips show the same wrong date: 1970-01-16

Any guesses in what that could be?

Thanks.

Upvotes: 0

Views: 268

Answers (1)

Fibericon
Fibericon

Reputation: 5793

Javascript date objects use milliseconds, not seconds. Try multiplying your unix timestamp by 1000.

Upvotes: 4

Related Questions