You are inputting your "datetime" column as a string, not a Date object. 
 Try using this to add your dates to the data:

while($row=mysql_fetch_assoc($result)){
    $datetimeArr = explode('-', $row['datetime']);
    $year = $datetimeArr[0];
    $month = $datetimeArr[1] - 1; // convert to zero-based index for month, 
used by javascript
    $day = $datetimeArr[2];
    $dataTable['rows'][] = array(
        'c' => array (
             array('v' => $row['Property']), 
             array('v' => $row['month']), 
             array('v' => $row['weekday']), 
             array('v' => $row['hour']), 
             array('v' => (int) $row['calls']),
             array('v' => (int) $row['duration']),
             array('v' => $row['scored']),
             array('v' => $row['callercategory']),
             array('v' => $row['answered']),
             array('v' => $row['callsource']),
             array('v' => $row['appointment']),
             array('v' => "Date($year, $month, $day)")
         )
    );
}

On Sunday, February 10, 2013 2:31:11 PM UTC-5, gapifan wrote:
>
> Folks, am at wits end with this one.  Have read a lot of olderposts and 
> tried a bunch of things but cant seem to get a handle on this date related 
> error:
> Object 2012-05-22 has no method 'getTimezoneOffset'
>
> I retrieve data from mysql and create my json data as follows.  The 
> date_sub function is moving the time from UTC to mytimezone. The dashboard 
> works fine with other controls so dont think that is a factor:
> $result = mysql_query("SELECT prop_id as Property, 
> date_format(date_sub(datetime, interval 7 HOUR), '%Y-%m')as month, 
> date_format(date_sub(datetime, interval 7 HOUR), '%w-%a')as weekday, 
> date_format(date_sub(datetime, interval 7 HOUR), '%H')as hour, 1 as calls, 
> duration, scored, callercategory, answered, callsource, appointment, 
> date_format(date_sub(datetime, interval 7 HOUR), '%Y-%m-%d')as datetime 
> FROM leads_phone WHERE 1 ORDER BY datetime ASC");
>
> $dataTable = array(
>     'cols' => array(
>          // each column needs an entry here, like this:
>          array('type' => 'string', 'label' => 'Property'), 
>          array('type' => 'string', 'label' => 'month'), 
>          array('type' => 'string', 'label' => 'weekday'), 
>          array('type' => 'string', 'label' => 'hour'), 
>          array('type' => 'number', 'label' => 'calls'),
>          array('type' => 'number', 'label' => 'duration'),
>          array('type' => 'string', 'label' => 'scored'),
>          array('type' => 'string', 'label' => 'callercategory'),
>          array('type' => 'string', 'label' => 'answered'),
>          array('type' => 'string', 'label' => 'callsource'), 
>          array('type' => 'string', 'label' => 'appointment'), 
>          array('type' => 'date', 'label' => 'datetime')
>         
>         
>     )
> );
>
> while($row=mysql_fetch_assoc($result)){
>     $dataTable['rows'][] = array(
>         'c' => array (
>              array('v' => $row['Property']), 
>              array('v' => $row['month']), 
>              array('v' => $row['weekday']), 
>              array('v' => $row['hour']), 
>              array('v' => (int) $row['calls']),
>              array('v' => (int) $row['duration']),
>              array('v' => $row['scored']),
>              array('v' => $row['callercategory']),
>              array('v' => $row['answered']),
>              array('v' => $row['callsource']),
>              array('v' => $row['appointment']),
>              array('v' => $row['datetime'])
>          )
>     );
> }
>
> $jsondata = json_encode($dataTable);
>
>
>
>
> I have the following chartrangefilter as a control for various charts in 
> my dashboard:
>
> var durationSlider = new google.visualization.ControlWrapper({
>      'controlType': 'ChartRangeFilter',
>      'containerId': 'duration_slider_div',
>      'options': {
>        // Filter by the date axis.
>        'filterColumnLabel': 'datetime',
>        'ui': {
>          'chartType': 'LineChart',
>          'chartOptions': {
>            'chartArea': {'width': '90%'},
>            'hAxis': {'baselineColor': 'none'}
>          },
>          'chartView': {
>                     'columns': [11, 4]
>          },
>                 // 1 day in milliseconds = 24 * 60 * 60 * 1000 = 
> 86,400,000 
>                 'minRangeSize': 86400000
>        }
>      },
>      // Initial range: 2012-02-09 to 2012-03-20.
>      'state': {'range': {'start': new Date(2012, 5, 22), 'end': new 
> Date(2013, 2, 20)}}
>    });
>   
>
> I get the Object 2012-05-22 has no method 'getTimezoneOffset' error.  
>
> Also wanted to take the opportunity to thank Asgallant and others for all 
> your help on this and other groups.  Your advise and guidance is invaluable.
>
> Thanks!
>
> Nikhil
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google Visualization API" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at 
http://groups.google.com/group/google-visualization-api?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to