Subject Re: SDF Dates
Author David Schnepper
Aaaagh! My comments are showing.....

All of a sudden I am extremely glad I was anal about documenting this
last time I re-wrote it for v6 Time & Date....

You should also look at the 3000 conversions I put into the TCS test
for it...

Just as an aside: Conversion of any string other than 'YYYY-MM-DD'
format is contrary to the SQL specification. The MM-DD-YYYY (etc)
formats were preserved for compatibility with prior releases.

Dave

--- In IB-Architect@egroups.com, Ann Harrison <harrison@n...> wrote:
> At 12:18 PM 7/9/2000 -0400, Jim Starkey wrote:
> >At 06:14 AM 7/9/00 +0800, you wrote:
> > >Interbase does not recognize the SDF representation for dates
which is
> > >YYYYMMDD.
> >
> >Piece of cake once the source is opened.
> static void string_to_datetime (
> DSC *desc,
> GDS_TIMESTAMP *date,
> EXPECT_DATETIME expect_type,
> FPTR_VOID err)
> {
> /**************************************
> *
> * s t r i n g _ t o _ d a t e t i m e
> *
> **************************************
> *
> * Functional description
> * Convert an arbitrary string to a date and/or time.
> *
> * String must be formed using ASCII characters only.
> * Conversion routine can handle the following input formats
> * "now" current date & time
> * "today" Today's date 0:0:0.0 time
> * "tomorrow" Tomorrow's date 0:0:0.0 time
> * "yesterday" Yesterday's date 0:0:0.0 time
> * YYYY-MM-DD [HH:[Min:[SS.[Thou]]]]]
> * MM:DD[:YY [HH:[Min:[SS.[Thou]]]]]
> * DD.MM[:YY [HH:[Min:[SS.[Thou]]]]]
> * Where:
> * DD = 1 .. 31 (Day of month)
> * YY = 00 .. 99 2-digit years are converted to the
nearest year
> * in a 50 year range. Eg: if this is 1996
> * 96 ==> 1996
> * 97 ==> 1997
> * ...
> * 00 ==> 2000
> * 01 ==> 2001
> * ...
> * 44 ==> 2044
> * 45 ==> 2045
> * 46 ==> 1946
> * 47 ==> 1947
> * ...
> * 95 ==> 1995
> * If the current year is 1997, then 46 is
converted
> * to 2046 (etc).
> * = 100.. 5200 (Year)
> * MM = 1 .. 12 (Month of year)
> * = "JANUARY"... (etc)
> * HH = 0 .. 23 (Hour of day)
> * Min = 0 .. 59 (Minute of hour)
> * SS = 0 .. 59 (Second of minute - LEAP second not
supported)
> * Thou = 0 .. 9999 (Fraction of second)
> * HH, Min, SS, Thou default to 0 if missing.
> * YY defaults to current year if missing.
> * Note: ANY punctuation can be used instead of : (eg: / -
etc)
> * Using . (period) in either of the first two
separation
> * points will cause the date to be parsed in European
DMY
> * format.
> * Arbitrary whitespace (space or TAB) can occur between
> * components.
> *
> **************************************/