[PYTHON DB-SIG] [comp.lang.python] Date-Time requirements (esp. for databases)

Jim Fulton jim.fulton@digicool.com
Wed, 30 Oct 1996 08:09:05 -0500


Anthony Baxter wrote:
> 
> arithmetic - difference between two dates. adding dates - it should be
>              possible to produce a DateTime object representing "1 week"
>              and say DateTime(now) + DateTime("1 week").

Oops.  In my earlier note I agreed with this without reading it 
carefully enough.  DateTime("1 week") doesn't make any sense to me.  
DateTime objects refer to specific points in time, not time units.

I think that DateTime objects should support addition/subtraction of
numbers to/from date-time objects.  I think we should decide what units 
are used for this.  IMO the units should be either days or seconds.
I'd vote for days myself, but I could live with seconds.

In addition, the DateTime class should have attributes that give the
lengths of various units of time.  Perhaps these attributes should be:
lengthOfYear(year), lengthOfMonth(year,month), lengthOfWeek,
lengthOfDay, lengthOfHour, lengthOfMinute, lengthOfSecond.  So the above
expression would become:

  DateTime(now) + DateTime.lengthOfWeek

Jim

-- 
Jim Fulton         Digital Creations
jim@digicool.com   540.371.6909
## Python is my favorite language ##
##     http://www.python.org/     ##

=================
DB-SIG  - SIG on Tabular Databases in Python

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