[Catalyst] datetime formatting ...
    Octavian Rasnita 
    orasnita at gmail.com
       
    Sat Feb 13 21:51:50 GMT 2010
    
    
  
From: "Kiffin Gish" <kiffin.gish at planet.nl>
> Well actually I want to relate it to the timezone of the current user or
> if that is not set in the user preferences, the browser time.
After you get the user time zone from users preferences, you can send it as 
a parameter to set_time_zone() method of DateTime.
You can do it in the templates:
[% row.last_modified.set_time_zone(c.user.get('time_zone')).strftime('%F 
%T') %]
(not tested, but it should work)
Don't know how to get the time zone of the user from browser, but I think it 
is not possible. You might need to get the visitor's IP and use a service 
that can tell you his/her country or even city, and maybe there is a module 
that can translate that into DateTime time_zone rformat...
Octavian
    
    
More information about the Catalyst
mailing list