[Zope] DateTime() BUG!
Tue, 08 May 2001 11:19:13 +0200
your viewpoint is true to some extent:
there is no Date-Object in Zope.
Its only a DateTime object and therefore it
consists of data _and_ time naturaly.
If you instantiate a DateTime object with a date only,
it sets time to 00:00:00.000 obviously.
(That is, DateTime is internally represented as floating point
So any days time is normally greater than the date it has.
(the amount is the seconds of the day)
You can use a trick to archive what you want:
DateTime(DateTime().Date()) gives you a DateTime-Object
with the Time of the day-start.
--On Dienstag, 8. Mai 2001 08:16 +0200 Kai Hofmann <email@example.com> wrote:
>> Kai Hofmann writes:
>> > the "enddate" I showed in the "pseudo"-code has been defined as an
>> > object= s=20
>> > property of type "date" - so I assumed the argument is correct -
>> > isn't it= ?
>> But then the result *IS* correct, too!
>> If you have, as is you example:
>> enddate=<todays date without time>
>> must return "false" most of the day.
>> As the name suggests: "DateTime" is date *AND* time.
>> "lessThanOrEqual" must take both components into account.
> From my point this is not correct, because of the following points:
> 1) within the enddate there is no time defined - so it is NOT possible to
> compare the time - following your argument - the result should be a TYPE
> ERROR, because its not possible to compare a date/time pair with a date
> 2) A date only describes a whole day - so comparing it with a date/time
> pair should always result in a compare of the dates only - because the
> time is out of interest here (its always within the date range).
> 3) If you want to ignore point 1) and 2) then you MUST add a time to date
> single date - to make the compare work - you can add any time - but it
> would only make sense to add 00:00:00 or 23:59:59 as time (start / end
> of day) For a lessThanOrEqual it would be usefull to assume 23:59:59 -
> for a greaterThanOrEqual it would be usefull to assume 00:00:00
> So your argument is not acceptable for me - sorry.
> Btw. for more about calendrical and time calculation have a look at my
> site at
> Hofmann Software Engineering International http://www.hofmann-int.de/
> Dipl.-Inform. Kai Hofmann mailto:firstname.lastname@example.org
> Arberger Heerstr. 92 phone:+49 174 1419312
> D-28307 Bremen/Germany fax:+49 421 4899933-1
> Zope maillist - Zope@zope.org
> ** No cross posts or HTML encoding! **
> (Related lists -
> http://lists.zope.org/mailman/listinfo/zope-dev )