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

W. Craig Trader ct7@kaizen.net
Tue, 29 Oct 1996 22:23:06 -0500 (EST)


On Wed, 30 Oct 1996, Anthony Baxter wrote:

> Other methods the DateTime objects should have:
> 
> strftime   - takes a format string, returns the date as a string in the 
> 	     specified format. ("%Y%M%D %H:%M:%S" -> "19961029 11:57:00")

This is good, though it duplicates the existing `time' modules function.

> 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").

I think you're wrong here - there should be multiple types:  DateTime, as
already discussed, and Interval, which would represent a signed quantity
of a generic unit (ie: 10 minutes or 2 hours or 1 week or 5 years), or 
possibly a combination.  Math would look like this:

	Interval + Interval => Interval
	Interval - Interval => Inverval
	DateTime + Interval => DateTime
	DateTime - Interval => DateTime
	DateTime - DateTime => Interval

Since we're talking about databases, the types should try to stick fairly
close to SQL, and SQL/92 already has provisions for DateTimes and
Intervals.

> Timezones. If the OS supports timezones, it should use it. Yes, this incurs
> some portability hassles, but that's the way things are - under Unix, the 
> timezone support is very good, and should be used. If Windows or whatever 
> has inadequate support for timezones, then something else should be provided 
> for that.

Again, I'd want to look towards SQL for this type of problem - the
theory's probably already been solved - why work hard only to produce
something that isn't compatible with major databases?  

> Hardcoding timezones is something that should be avoided. Particularly with
> daylight savings, which is a hideous political issue. Australia has 8 states
> and territories - nearly every one of these has different timezone/DST rules.

Well, at least South Australia is no longer 1.5 hours off from Queensland.
That was a *real* lousy system.  Of course, Indiana in the States is the
worst - it varies county by county.  <sigh>

- Craig -


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

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