[Catalyst] datetime formatting ...

Kiffin Gish kiffin.gish at planet.nl
Sat Feb 13 22:20:33 GMT 2010

Thanks. You're right about the timezone thing, I was confused with
javascript and now realize that the tz is not passed via HTTP headers.
Could save it in a cookie.

Is $c->user->get(x) the same as $c->user->x ?


On Sat, 2010-02-13 at 23:51 +0200, Octavian Rasnita wrote:
> 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
> _______________________________________________
> List: Catalyst at lists.scsys.co.uk
> Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
> Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
> Dev site: http://dev.catalyst.perl.org/

Kiffin Gish <Kiffin.Gish at planet.nl>
Gouda, The Netherlands

More information about the Catalyst mailing list