Unix format in Google Chart GUI format?

It’s hard for me to figure out the date and time format using Google Chart. I used example [1], where the date and time format is set to a simple month and year, but I changed it to introduce input of type datetime. An example is available on the following page:

http://www.sccs.swarthmore.edu/users/09/leo/cgi-bin/viewer.php

The beginning of the code is as follows:

data.addColumn('datetime', 'Date');
data.addColumn('number', 'Active or not');      
data.addRows(1768);
data.setValue(0, 0, new Date(1306192258));
data.setValue(0, 1, 1);

Why will Google change the date format to January 15, 1970? (The time of the beginning of the era?)

Thank!

[1] http://www.beakkon.com/geek/how-to/create-interactive-charts-using-google-charts-api

+3
source share
2 answers

Try the following:

data.addColumn('datetime', 'Date');
data.addColumn('number', 'Active or not');      
data.addRows(1768);
var d = new Date();
d.setTime(1306192258*1000);
data.setValue(0, 0, d);
data.setValue(0, 1, 1);
+5
source

Javascript Date w3schools.com - ( "21 2011 02:00:00" ), , .

data.addRows([
[new Date("July 21, 2011 00:00:00"), 0.319636363636 ],
[new Date("July 21, 2011 07:00:00"), 0.319636363636 ],
[new Date("July 21, 2011 22:00:00"), 0.319636363636 ],
[new Date("July 21, 2011 23:00:00"), 0.319636363636 ],
[new Date("July 22, 2011 09:00:00"), 0.319636363636 ],
[new Date("July 22, 2011 10:00:00"), 0.319636363636 ]
]);
+1

All Articles