Hi Abu,
We have clients spread across the globe,
We are saving the grid data in UTC time zone now
How can I display the data with the timezone of the client in the grid.
I need to convert the date which is in UTC to the client's timezone.
Can I do something with this function
col["on_data_display"] = array("Function","");
Thanks
This is something that is outside the scope of phpgrid.
I would recommend to following stackoverflow solutions. 1) cookie based 2) maxmind geoip based.
http://www.google.com/search?q=php+client+timezone
Hi,
Thanks for the reply.
Let me re-frame my question, Is there a way to display data saved in UTC as UTC+ 5:30 in the grid?
I save my data in UTC, I need to convert it to timezone of the client(I know which timezone My clinets are in) and display it in the grid
I think this function will do your work UTC to local.
http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html#function_convert-tz
// you can provide custom SQL query to display data
$g->select_command = "SELECT i.id, CONVERT_TZ(invdate,'+00:00','+5:30') as invdate , c.name,
i.note, i.total, i.closed FROM invheader i
INNER JOIN clients c ON c.client_id = i.client_id";
To save data back in UTC, you may need to use on_insert / on_update function.