Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Federico Davila on Dec 29, 2008 13:19
open dhtmlx forum
Show dateme in localtime

I'm using the grid with smart rendering, and i need to show a field datetime in localtime, but is stored in the database as utc, how can I do this? If I parse it in the server I get the local time from the server but I need the local time from the client.
Answer posted by Support on Dec 29, 2008 16:06
There is no ready solution for such task , you can use onRowCreated event of grid to dynamically change data on client side.

grid.attachEvent("onRowCreated",function(id){
     value = grid.cells(id,0).getValue();
     value = any_kind_of_custom_format(value);
     grid.cells(id,0).setValue(value);
})

By the way, usage of client side time formating is not the best solution - the time of browser may differ from actual timezone of user , which may lead to erros.