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

Chris Chen cchen@stc.com
Mon, 28 Oct 1996 17:37:03 -0800


        In the old Informixdb module I have, both Date and Date-Time data
type (they shared the same dbi.DATE type) were converted to standard C
time_t value.  I can retrieve the time value by using either time.ctime or
time.localtime function in the python buildin time module, and the buildin
time module actually call the standard C time function.  This means they do
support the time zone and daylight savings time, but may have difficulty in
handling all dates in the Gregorian calendar, or represent the fractional
second that exist in some database.

        Currently, I don't have any problem with using time_t value to
represent Date-Time data type, but I will prefer a separate dbi.TIME to deal
with the Date-Time data type.  Also some enhancement to the buildin time
module to include difftime & tzset method would be much appreciated.   The
more immediate problem is how to represent the DATE type.  By converting
DATE value to time_t value, it contains more information than it really is
which may cause problem in some situation.  I also like to know if there is
a standard string format for dbi.DATE data type ?  Does the DATE format has
support for different country (or locale) ?

        Should we think about a "generic" python Date-Time type to solve all
these problem.  After all, time is too unigue a concept to treat it
causully.  I really think most modern language didn't pay enough respect to
this forth dimension of the universe.  I hope python isn't one of them :-)

-Chris Chen

At 12:50 PM 10/28/96 -0500, Jim Fulton wrote:
>------- Start of forwarded message -------
>From: jim@digicool.com (Jim Fulton)
>Subject: Date-Time requirements (esp. for databases)
>Newsgroups: comp.lang.python
>Date: 28 Oct 1996 12:49:17 -0500
>Organization: Digital Creations, L.C.
>Path: news.infi.net!usenet
>
>
>A number of databases support date-time data.  It would be helpful to
>have a standard date-time implementation for use in Python database 
>implementations (and elsewhere, of course).  
>
>I think that the date-time implementation should:
>
> 1. Support conversion from strings in a very wide variety of formats
>    (e.g. 'Oct, 1, 1994 12:34am EST', '1994/10/1 00:34:21.456')
>
> 2. Support subtraction of date-times, and addition and 
>    subtraction of dates and numbers.
>
> 3. Store dates efficiently.
>
> 4. Store dates immutably.
>
> 5. Represent dates to a specified minimum precision 
>    (e.g. milliseconds).
>
> 6. Handle all dates in the Gregorian calendar.  (e.g. there should
>    not be problems storing dates from the 18th or 21st centurys.)
>
> 7. Provide read-access to date-components (e.g. year, month, second,
>    day-of-week, etc.)
>
>I'm afraid the implementation should also address issues like:
>
> 8. Support for time-zones,
>
> 9. Support for daylight-savings time.
>
>I have an implementation of date-time data that meets requirements
>1-7 and a little of 8, however, this implementation is encumbered and
>I plan to create a new implementation.  If I reimplement my date-time 
>data type, I'd like to do so in a way that is useful to the Python
>community at large, and to people developing database interfaces in
>particular.  I'm particularly interested in suggestions on whether and
>how and how much to deal with issues such as time zones and (ugh)
>daylight-savings time.
>



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

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