[Zope] strftime and timezone
Hong Yuan
hongyuan at homemaster.cn
Thu Mar 17 22:26:51 EST 2005
>>...
>>How can I fix this?
>>
>>
>
>The easiest way would be to use a different (and unique) notation for
>your timezone, e.g. "GMT+8".
>
>
Well, it turns out not to be so easy. I found that even a notation like
"GMT+8" is not unique in meaning, see
http://docs.sun.com/app/docs/doc/806-5189/6je7g4sr7?a=view. It can mean
8 hours east of GMT, or 8 hours west of GMT!!! And again zope DateTime
seems to interprete this differently than the Linux operation system.
With my operation system timezone now set to Etc/GMT-8:
ws1:/usr/lib/zope2.7/lib/python# date
Fri Mar 18 10:49:44 GMT-8 2005
ws1:/usr/lib/zope2.7/lib/python# cat /etc/timezone
Etc/GMT-8
I now get:
>>> from DateTime import DateTime
>>> a= DateTime('2005/01/01 08:00 GMT-8')
>>> a
DateTime('2005/01/01 08:00:00 GMT-8')
>>> a.strftime('%Y-%m-%d %H:%M:%S %Z')
'2005-01-02 00:00:00 GMT-8'
Isnt' that very confusing? Instead of the 14 hours off with CST, I now
get 16 hours off!
If zope interpretes the timezone abbreviation differently than the
operation system, it will causer the users/developers a lot of headache.
I think this could be called a bug now instead of just a nusance. For
the moment, I have to switch to Date() and Time() instead of strftime.
--
HONG Yuan
Homemaster Trading Co., Ltd.
No. 601, Bldg. 41, 288 Shuangyang Rd. (N)
Shanghai 200433, P.R.C.
Tel: +86 21 55056553
Fax: +86 21 55067325
E-mail: hongyuan at homemaster.cn
More information about the Zope
mailing list