On Mon November 7 2005 08:21 am, Jürgen Herrmann wrote: > DateTime('2005/04/03 02:01 GMT').toZone('GMT-4') > > prints: > 2005/04/02 22:01:00 GMT-4 > ...which is what i expected > --------------------------------------------------------------------- > DateTime('2005/04/03 02:01 GMT').toZone('GMT-4')\ > .strftime('%Y/%m/%d %H:%M %Z') > > prints: > 2005/04/03 04:01 > > hmm, where's the timezone information gone? to make it short, how > can i get a text representation of a DateTime object in a given > timezone?
strftime() timezone is broken in all versions of Zope that I know of. You can work around it by using the individual functions to get the information. For example (not verified): dt = DateTime('2005/04/03 02:01 GMT').toZone('GMT-4') '%s/%s/%s %s:%s %s' % (dt.year(), dt.month(), dt.day(), dt.hour(), dt.minute, dt.timezone()) or, if you throw the seconds in there and you keep them in the same order, you can just use parts(): '%s/%s/%s %s:%s:%s %s' % (dt.parts()) -- Ron _______________________________________________ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )