Google Charts API datetime unix format?

I’m having a hard time getting Google Charts to understand the datetime format. I used an example [1] where the datetime format is set to a simple month day and year, but I changed it to take an input of type datetime. An example is available the following page:

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

  • embed google drive picker as a part of page
  • Angularjs: To Auto Fill City and State from Zip input, Need help to integrate
  • Google Visualization Issue with Small Values in Pie Chart
  • Add events to google calendar,yahoo calendar, outlook and ical
  • Getting JSON with list of national holidays Google Calendar
  • google.load - and message “google is not defined”
  • The start 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 that Date format to Jan 15, 1970? (Start of Epoch time?)

    Thanks!

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

  • Welcome back, you've already connected with this app via Google+ Sign-In as *
  • Google calendar API update “Missing end time”
  • Searching Google Spread Sheet API
  • How to get around the CORS issue in Google's API?
  • “cannot read property length of null” - Google
  • “ Google API message ” : “ This API does not support parsing form-encoded input. ”
  • 2 Solutions collect form web for “Google Charts API datetime unix format?”

    Try this:

    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);
    

    Some more info on the Javascript Date function can be found w3schools.com website
    I found – new Date(“July 21, 2011 02:00:00”) to be a good compromise for what I wanted to do.

    Snippet of my code

    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 ]
    ]);