[Catalyst] datetime formatting ...

Stuart Watt swatt at infobal.com
Sat Feb 13 22:17:16 GMT 2010


On 2010-02-13, at 4:51 PM, Octavian Rasnita wrote:

> 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...

We did this using JavaScript. Just create a Date object and call getTimezoneOffset on it. We actually do that twice, one for a summer date and one for a winter date. Then we look at both offsets and use that to guess a location (rather than just the current time offset). I can send the code if needed. 

The technique works pretty well, and gets the timezone pretty well. 

All the best
Stuart

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.scsys.co.uk/pipermail/catalyst/attachments/20100213/ab0617ca/attachment.htm


More information about the Catalyst mailing list