[Zope3-dev] datetimeutils: add localize datetime?

Stephan Richter srichter at cosmos.phy.tufts.edu
Tue Feb 1 06:43:10 EST 2005


On Monday 31 January 2005 20:42, Gary Poster wrote:
> hi y'all.  Two related questions about datetimeutils.  I needed
> something to localize a naive datetime.datetime (i.e., add a timezone)
> on the basis of system time.  I decided to harden them using the
> approach in datetimeutils, so I leveraged some protected (_*) methods
> in datetimeutils and got something that does the job in five or six
> lines. 

I would really like to deprecate datetimeutils. It is just evil. However, we 
cannot remove it until someone adds TZ support to zope.i18n.

> My questions:
> does something like this exist already? 
> If not, anyone mind if I check it into datetimeutils? 

The right way to do it would be to import a timezone package based on 
datetime, and implement the necessary lines in zope.i18n.format (around line 
105 for parsing and lines 575-586 for formatting). You can see that the code 
should not be too hard as long as the timezone can give us the following 
representations: "+000", "+00:00", "UTC" and "Greenwich Time". Of course, 
there needs to be a function that can give us the timezone for any of the 
given strings.

Regards,
Stephan
-- 
Stephan Richter
CBU Physics & Chemistry (B.S.) / Tufts Physics (Ph.D. student)
Web2k - Web Software Design, Development and Training


More information about the Zope3-dev mailing list