Convert javascript ticks to date in Flot jQuery-plugin issue

Posted by Kasper Skov on Stack Overflow See other posts from Stack Overflow or by Kasper Skov
Published on 2012-09-14T13:06:52Z Indexed on 2012/09/14 15:38 UTC
Read the original article Hit count: 635

Filed under:
|
|
|
|

I have a dynamic Flot graph with dates on the x-axis and numbers on the y-axis. To get the Flot-plugin to read the date object correctly, I had to convert the dates to ticks (with getTime()). My problem is that I can't revers the ticks back to a normal date in my tooltip hover on the graph. enter image description here

I've tried to revers it with this:

dateTimeObject = new Date((jsTicks - 621355968000000000) / 10000);

All I get, no matter what jsTicks is, is "Jan 02 0001 hh:mm:ss (almost current time)"

What am I doing wrong?

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about jQuery