John Peacock <[EMAIL PROTECTED]> wrote:
>Dave Rolsky wrote:
>> - Work with just dates and do date math on them (at the level of days,
>> months & years).
>
>I think I was one of the ones advocating for a way to do this [...]
I second this. I'm not sure how much you work with SQL, but the standard
splits things up into 5 related types:
DATE - no time zone
TIME WITHOUT TIME ZONE
TIME WITH TIME ZONE
TIMESTAMP WITHOUT TIME ZONE
TIMESTAMP WITH TIME ZONE
DATE has components from year down to day; TIME has components from hour
down to microseconds (or finer); and TIMESTAMP contains components from
year down to microseconds (or finer). The 'WITHOUT TIME ZONE' qualifier
is optional, and the default. IIRC, the date range is supposed to be from
0001-01-01 through 9999-12-31.
I would certainly like to see classes corresponding to DATE and TIMESTAMP.
Whether you need the separate class corresponding to TIME is more
debatable. SQL also has an INTERVAL type, which can describe durations of
time. For example, INTERVAL YEAR(9) for geologic times, or INTERVAL
DAY(9) TO SECOND(6). (There's a barrier; you can't mix YEAR/MONTH
intervals with DAY/SECOND intervals, because months are variable size.)
Informix Dynamic Server (IDS) has a set of DATETIME types (including
weirdos such as DATETIME MONTH TO MINUTE; no, you don't have to deal with
that). If no time zone is specified, then some timezone is the default
(local or UTC are the only serious contenders), but there are people who
have not need of explicit time zone support - lucky devils.
So, I recommend that you do indeed support two distinct sets of
inter-related calculations - one on dates without time or timezone, and
one on timestamps including timezones.
--
Jonathan Leffler ([EMAIL PROTECTED])
STSM, Informix Database Engineering, IBM Information Management Division
4100 Bohannon Drive, Menlo Park, CA 94025
Tel: +1 650-926-6921 Tie-Line: 630-6921
"I don't suffer from insanity; I enjoy every minute of it!"