Date-Time type (was Re: [DB-SIG] DB-API Spec. 1.1a1)

Hannu Krosing hannu@trust.ee
Tue, 09 Dec 1997 15:43:05 +0200


M.-A. Lemburg wrote:

> > Again, this is really not an issue for the DBI though. I agree that dates
> > (and timestamps) could be standard Python types.
>
> Which is what we are aiming at... well, at least I am :-) [This isn't
> exactly the right place to discuss all this, but the main list is
> just too noisy so I'll continue here if noone objects]

Seems that the date type is most often required by the same people who use the DBI
so it may not be entirely wrong place.

> > Converting to dates from hand entered strings in all sorts of formats is
> > a big mess that should be kept out of a database interface. For instance
> > 3/4/5 might at least mean three things (if we agree on which century we
> > refer to): 3 Apr 2005, 4 Mar 2005 or 5 Apr 2003. This should be handled
> > by Löwis locale stuff.
>
> Conversion from date/time to strings is left to strftime(). The
> other way around could be handled by an elaborate module written
> in Python (something a la Skip's date.py) -- it's much too messy
> to get written in C.

The most foolproof way should be the one that I used to use when using Oracle.It
was a method that took two strings, date representation and format, and returned
the date "object".

The conversion from date to string could also be done using an explicit format.

In python we could of course use a default argument for the explicit format.

Hannu Krosing


_______________
DB-SIG  - SIG on Tabular Databases in Python

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