Verify x with typeof function like this :
console.log(typeof x);
X must to be an number (int) if is an timestamp (like this 1404792000000), use parseInt() function if x is a string.
var date = new Date(parseInt(x));
showTooltip(item.pageX, item.pageY, (date.getMonth()+1)+"-"+date.getDate()+"-"+date.getFullYear()+" / "+y );
Example :
date = new Date("1404792000000"); // String : Date {Invalid Date}
date = new Date(1404792000000); // Integer : Date {Tue Jul 08 2014 ...}
date = new Date(parseInt("1404792000000")); // Str to int : Date {Tue Jul 08 2014 ...}
Without parseInt, use the calculator operator. (@RobG comment)
Like this :
date = new Date(+"1404792000000"); // Str to int
Which is better to use for a calculator parseInt() or eval() in Javascript?