Licence |
What time is it?The lawtec site is hosted in Holland, and I am in Australia. So What I'm finding is that the time objects are apparently created is local to Holland, not to Australia. I'd really like to be able to have the 'created' time set to the time that I have posted the article. Wouldn't have the faintest clue about how to do it, but if I find the answer, I'll post it here. If you have your own zope instance ...
Posted by
Anonymous User
at
05-Apr-05 12:01 AM
If you have your own zope instance and the OS is UNIX like you can do the following:
- There exist a enviroment variable named TZ to specify the time zone of a user. See 'man environ' for more information. - You can set this variable in the runzope script in order than you zope instance works with the time zone you want. - Add TZ= GMT ; for other timezones see 'man environ' EXPORT TZ - Restart zope. - Now all your dates are printed in that time zone. |
What time is it?
Well, its easier than I thought.
A simple example:
DateTime().toZone('GMT+1000')That's right, a function is all you need. Now I use a script, courtesy of Plone called toPortalTime to format all my times. So I just had to add the toZone call before the strftime call:
## parameters time=None try: localized_time=DateTime(str(time)).toZone('GMT+1000').strftime(format) except IndexError: pass return localized_time