[Zope] DateTime.strftime problem

Ron Bickers rbickers-list-zope2 at logicetc.com
Sun Jan 30 03:47:03 EST 2005


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().

For example (my local timezone is US/Eastern):

  now = DateTime('US/Pacific')

  now.pCommonZ()
  Jan. 30, 2005 12:35 am US/Pacific

  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?

-- 
Ron


More information about the Zope mailing list