Jeffrey C. Ollie jeff@ollie.clive.ia.us
Thu, 20 Feb 1997 14:23:10 -0600


On Thu, 20 Feb 1997 11:28:42 -0800, mlorton@microsoft.com writes:
>Dates in Python really should have a "precision" , the way they do in
>real life.  1996 is a date, right?  It just has a precision of one year.

Yes, a very interesting suggestion.

>There are some provocative questions:
>1.  What does equality mean?  Does "noon today" "equal"  1997-02-20
>12:00:00.0.  Does it equal "today"?  1997?

There should be a module-level global variable that switches between
precise matching and non-precise matching. By exact matching, I mean that
when comparing two dates, the precisions must be equal and the dates must
match within that precision. Comparisons of dates with different precisions
would raise an exception.

With non-precise matching, the date with the higher precision would be
converted to the lower precision and then the comparison would be made.

>2.  If we allow (a form of) date-equality that means inclusion, D1 == D2
> IFF ( D1 contains D2 or D2 contains D1), what about timezones?  By this
>definition 1997 in Seattle does not equal 1997 in Amsterdam, since there
>is, what, nine hours overhand on each side.
>3.  What about total-ordering?  Is 1997 in Amsterdam "less than" New
>Years Day  in Seattle (because it started first), "equal to" (because it
>overlaps) or "greater than" (because it ends last)?

The internal representation of a date should always be UTC. That
completely eliminates this kind of confusion.

Conversion to/from local time should be supported for the convenience
of humans only.

[A copy of the headers and the PGP signature follow.]
Date: Thu, 20 Feb 1997 14:23:10 -0600
From: "Jeffrey C. Ollie" <jeff@ollie.clive.ia.us>
In-reply-to: Your message of "Thu, 20 Feb 1997 11:28:42 PST."
Subject: Re: [PYTHON DB-SIG] DbiDate in DBAPI 
To: db-sig@python.org

Version: 2.6.2
Comment: AnySign 1.4 - A Python tool for PGP signing e-mail and news.

Jeffrey C. Ollie                     |            Should Work Now (TM)
Python Hacker, Mac Lover             |

DB-SIG  - SIG on Tabular Databases in Python

send messages to: db-sig@python.org
administrivia to: db-sig-request@python.org