[Zope] Help with DateTime.earliestTime()

Eric Thomas eric at thomasfam.com
Sat Aug 25 08:18:42 EDT 2007


I've been having a site problem that I've tracked down to DateTime.  Simply
enough, the code snippets below both try to add 31 days to the first day in
October.  I'm expecting this to result in the first day of November.

Good Example:

>>> from DateTime import DateTime
>>> start=DateTime('2005/10/01 01:00:00 GMT-5')
>>> print start
2005/10/01 01:00:00 GMT-5
>>> earlyStart=start.earliestTime()
>>> print earlyStart
2005/10/01
>>> print earlyStart+31
2005/11/01

Bad Example:  (Here's the problem)

>>> from DateTime import DateTime
>>> start=DateTime('2005/10/01 01:00:00 US/Central')
>>> print start
2005/10/01 01:00:00 US/Central
>>> earlyStart=start.earliestTime()
>>> print earlyStart
2005/10/01
>>> print earlyStart+31
2005/10/31 23:00:00 US/Central

I've confirmed this occurs with several of the US/ timezones (US/Pacific,
US/Alaska, etc)

Can anyone help me figure out why the resulting date is coming up 1 hour
short of the expected 2005/11/01 ?

Thanks!

Eric
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.zope.org/pipermail/zope/attachments/20070825/99f83447/attachment.htm


More information about the Zope mailing list