Ron Bickers wrote at 2005-1-30 03:47 -0500:
I'm running Zope 2.7.4 and I'm trying to format the current time in the format "yyyymmddhhmmssZ" (that is with a timezone of UTC), but I can't do it.
The DateTime API says that "A DateTime object's methods return values based on the timezone context." This appares to be the case for all except strftime(). ... now.rfc822() Sun, 30 Jan 2005 00:35:58 -0800
now.strftime('%Y/%m/%d %H:%M:%S %Z') 2005/01/30 03:35:58 EST
It looks like Collector Bug 1127 (http://zope.org/Collectors/Zope/1127/) changed strftime() to always work in the local timezone, instead of always working in GMT as it did before. But shouldn't it respect the timezone of the DateTime object as do the other methods? Is this a bug?
I yesterday looked at the implementation of "DateTime.strftime" (Zope 2.7.2). Apparently, it tries to take the timezone into account. And it works for me:
now=DateTime() now DateTime('2005/01/30 19:32:08.823 GMT+1') now.strftime('%H') '19'
-- Dieter