Subject | RE: [ib-support] Date Format in IB |
---|---|
Author | jackie |
Post date | 2002-10-31T09:48:02Z |
Well darn my off topic post has ta least spurred some in-depth discussion on
date formats.
Thanks for all the replies
jackie.
date formats.
Thanks for all the replies
jackie.
> -----Original Message-----
> From: Helen Borrie [mailto:helebor@...]
> Sent: Thursday, October 31, 2002 3:16 PM
> To: ib-support@yahoogroups.com
> Subject: RE: [ib-support] Date Format in IB
>
>
> At 05:26 PM 30-10-02 -0500, you wrote:
> >At 08:53 AM 10/31/2002 +1100, Alan McDonald wrote:
> > >Ann,
> > >Has this changed sometime?
>
> Ann wrote:
>
> >No, but what we're seeing are conversions done in
> >the interface. Dates can be converted to floating
> >point - that's how they're indexed, as it happens.
> >I don't know whether it was InterBase or Delphi that
> >did the conversion, but the InterBase internal format
> >is two longwords.
> >
> > >Also I used to see "zero" dates come up in reports as 31 Dec
> 1899 - when
> > did this starting point change?
>
> It hasn't changed in all the time I've been using Delphi and/or
> InterBase. Delphi's date zero has always been (I think) 30 Dec 1899 and
> IB's was always 17 Nov 1858. Although Delphi dates are doubles, not a
> packed structure like IB's, it can still be convenient to think
> of them as
> two time-lines each looking at the "catchment of possible dates"
> in similar
> ways but from two different starting blocks.
>
> Ann wrote:
> >Ah. Whatever you were using went through the date
> >conversion routines. They use the Unix/C tm structure
> >which is uses Jan 1 1900 as its base date. It's a
> >wonderful thing. Doesn't recognize anything smaller
> >than a second. Months are zero based. Days are one
> >based. So year 0, month 0, day 1 is 1 Jan 1900.
> >Year 0, month 0, day 0 must be one day less, so...
> >31 Dec 1899.
>
> Just as a matter of interest (in the course of trying to refresh
> my memory
> about Delphi's zero-date being 30 Dec 1899 and not 31 Dec 1899) I
> attempted
> this little experiment on a Dialect 3 database:
>
> CREATE TABLE TEST_DATE (
> ID INTEGER NOT NULL PRIMARY KEY,
> DATE1 TIMESTAMP,
> DATE2 DATE);
>
> commit;
>
> insert into test_date
> values (101, cast ('today' as timestamp),
> cast (current_date - current_date as date);
>
> The above (and everything else) came up every time with this or a similar
> error, not at Prepare time but at Post time:
>
> ISC ERROR CODE:335544334
>
> ISC ERROR MESSAGE:
> conversion error from string "0"
>
> ...and various other ploys to get Fb to accept zero as a date, e.g.
>
> insert into test_date
> values (101, cast (current_timestamp - current_timestamp as timestamp),
> current_date)
>
> ISC ERROR CODE:335544334
>
> ISC ERROR MESSAGE:
> conversion error from string "0.000000000"
>
> It accepts '1858-11-17' as a date literal and Delphi happily displays it
> (from the database) as that date.
>
> It's interesting because, IIR, in lower versions, IB would allow you to
> store a number 0, a string literal '0' or the result of an
> expression like
> the one above.
> It might or might not be the outcome of any changes in either
> Delphi or IB
> though, since my recollections of IB 4.x go back to the days when I used
> the BDE and it's quite likely the BDE did the "fudge" that permitted
> storage of zero in a (then) date-time DATE field.
>
> Oh, and I still haven't confirmed whether my recollection of
> Delphi's zero
> date was wrong or not...these days I don't have either IB 4.x or the BDE
> around my systems at all so it will just have to stay being a "niggle".
>
> cheers,
> heLen
>
>
>
> To unsubscribe from this group, send an email to:
> ib-support-unsubscribe@egroups.com
>
>
>
> Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
>
>
>