I am on mobile now and I cant ellaborate a good code example, but I can give you a hint.
db.table.datefield.represent = lambda value, row : value.strftime("%Y/%m/%d") grid = SQLFORM.grid(db.table) so grid will use the represent callback to display the data. following this example you can do def set_timezone(value, row): return value. #do the calculation db.table.field.represent = set_timezone Em 12/02/2013 04:44, "newbie" <nehadu...@gmail.com> escreveu: > > On Tuesday, 12 February 2013 11:06:00 UTC+5:30, newbie wrote: >> >> Hi, >> I have a table x, with fields name,place,timezone_offset.And another >> table y ,having field 'servertime',which **stores the current time of >> the server its fetching the values from. >> >> db.define_table('x',Field('**name'),Field('place'),Field('** >> timezone_offset')) >> db.define_table('y',Field('**name'),Field('ser**vertime')) >> > > User will set the timezone offset in table x, for a particular name. There > is one thread continuously running in background in the server which will > save the servertime as local time using datetime.datetime.now() in table y > for the name. > > And finally this data displayed by using SQLFORM.grid on the UI. > > Problem facing: > We have to convert the local time saved for the name field as per saved > timezone_offset in x table and display on the grid without modifying > anything on database level. > It means suppose for name ='Alex' timezone_offset was being saved as -5 > in x table and suppose server running on different timezone lets say on > +5.30 so for name Alex server will save the servertime in +5.30 format as > it is the local time for the server but when it will be displayed on the > grid servertime should first get converted to Alex timezone_offset which is > set as -5 and then display on the grid. > > Can anyone please suggest me how can I achieved in web2py? Is there any > way to achieve it using SQLFORM.grid()? > > Thanks. > > > > >> >> > -- > > --- > You received this message because you are subscribed to the Google Groups > "web2py-users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to web2py+unsubscr...@googlegroups.com. > For more options, visit https://groups.google.com/groups/opt_out. > > > -- --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.