[Zope] Re: Help with DateTime.earliestTime()
Maurits van Rees
m.van.rees at zestsoftware.nl
Mon Aug 27 12:57:32 EDT 2007
Eric, on 2007-08-26:
> To work around this, I've modified the addition so that instead of adding 1
> day, it adds 1.5 days. This extra half a day is removed by the
> theDateTime.earliestTime() call but is enough to overcome the DST addition
> problem. Ugly hack.
I had the same problem once in the eXtremeManagement Plone product.
For a monthly overview I needed to do something for every day of the
month. I worked around it with the code below.
day = 1
date = DateTime(2007, 10, 1) # 1 October 2007
while True:
# skipped some lines irrelevant to the DateTime problem
day += 1
try:
date = DateTime(self.year, self.month, day)
except:
break
Hm, that should probably be "except DateTime.DateTime.DateError" but
there is not really anything else that can go wrong here.
--
Maurits van Rees | http://maurits.vanrees.org/ [NL]
Work | http://zestsoftware.nl/
"Do not worry about your difficulties in computers,
I can assure you mine are still greater."
More information about the Zope
mailing list