Click here to Skip to main content
15,890,506 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello all,
I have a chart that has 2 columns with 'timeofday' and 'number' format. The chart gets displayed but the time value is wrong. If the time is 00:00 (HH:mm), it displays as 05:30 which adds +05:30 for all the time values. I have included timezone but that does not create any impact on the values. Please help how to handle this. I am stuck in this...

What I have tried:

C#
google.charts.load('current', {'packages':['line']});//type of chart is line chart
    google.charts.setOnLoadCallback(drawChart);

var dateFormatter = new google.visualization.DateFormat({formatType: 'long',timeZone: -0530 });
dateFormatter.format(data,0);
Posted
Updated 14-Mar-17 5:38am
v3
Comments
Jochen Arndt 14-Mar-17 7:48am    
You are probably using some kind of PHP chart library / module.
But without knowing which and how you use it, nobody here can help.

Please use the green 'Improve question' link to add the necessary information to your question.
User1454 14-Mar-17 11:37am    
Yeah thanks!!. My mistake.. updated it..
Graeme_Grant 14-Mar-17 11:40am    
"which adds +05:30" but you have asked for "-0530". Are you sure it is added???
User1454 14-Mar-17 11:45am    
Hi, this is one of the datetime value I have 2017-02-18 00:00:42 in which I need only HH and mm, but in charts in tooltip it is displayed as "05:30:42". It adds "05hrs:30minutes" to all the values

1 solution

Not knowing the lib that you are referring to, but date values can be either localized or UTC (Universal Time).

My guess is that you are passing a Localized server time where the lib is expecting a UTC time. Try converting to UTC before making the lib call.
 
Share this answer
 
Comments
User1454 14-Mar-17 11:39am    
Hey @Graeme_Grant you are right!! This is my Indian time 2017-02-18 00:00:42,889 and I take only HH and mm from this for display. I will try that.. thanks
User1454 15-Mar-17 1:04am    
Hi I tried the following solutions:
1. gmdate('d.m.Y H:i', strtotime('2017-02-18 00:00:42') but gives wrong date time 01.01.1970 00:00.
2. $timestamp = strtotime("00:00" - 19800); but shows wrong values
Graeme_Grant 15-Mar-17 1:16am    
As I previously mentioned, I have not used that lib. Google does have API documentation for this Lib and has a specific section on Dates & Times: Dates and Times  |  Charts  |  Google Developers[^]

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900