[Zope-dev] [Bug] DateTime(string) uses GMT as timezone

Steve Alexander steve@cat-box.net
Sun, 30 Sep 2001 22:08:51 +0100


Dieter Maurer wrote:

> Unfortunately
> 
> 	DateTime(year,month,day) != DateTime("%d-%d-%d" % (year,month,day))
> 
> The former uses the local timezone (which I think is right)
> while the latter uses GMT+0 (which seems not right).
> 
> Thinks are quite bad, as the latter is used to convert
> ":date" form values into DateTime objects.


See also here:

http://lists.zope.org/pipermail/zope-dev/2001-August/012974.html

----

I get different times from a string, depending whether I use '-' or '/'
as a date delimiter.

  >>> from DateTime.DateTime import DateTime
  >>> DateTime('2001-08-20').pCommonZ()
'Aug. 20, 2001 12:00 am GMT+0'
  >>> DateTime('2001/08/20').pCommonZ()
'Aug. 20, 2001 12:00 am GMT+1'
  >>>

I find the difference a tad surprising.

Is this a bug or a feature?

If it's a bug, I'll work on a fix.

I'm guessing this is a feature; perhaps using the '-' delimiter suggests
I'm trying to use ISO formatting.

I'm running this in a GMT+1 timezone btw.

Zope latest from CVS, Python 2.1.
----

I never got a reply as to whether it was a bug or a feature, so I didn't 
work on a fix.

--
Steve Alexander
Software Engineer
Cat-Box limited