Subject | Re: [firebird-support] how to insert DATE in a different format? |
---|---|
Author | Helen Borrie |
Post date | 2005-06-30T06:15Z |
At 05:57 AM 30/06/2005 +0000, you wrote:
stores them in a numeric format. When you offer a string as input to a
date/time type, what you are really offering is a date literal. As long as
the parser can make sense of the format of the literal, it can convert this
literal to a date/time type and store it correctly. The reverse process -
the string that gets returned when the Firebird engine retrieves date/time
types is not a question of "inverting" the inward process.
A literal in the format 'dd/mm/ccyy' or 'dd/mm/yy' is NOT one that Firebird
interprets as a valid date. With a slash separator, only 'mm/dd/ccyy' or
'mm/dd/yy' is valid. Hence, your example would mean "the first day of the
15th month" so it is rejected as invalid. '9/01/2005' would be interpreted
as "September 1st".
We who operate beyond the shores of the United States use 'dd.mm.ccyy',
'ccyymmdd', 'ccyy-mm-dd' or 'dd-MMM-ccyy' mostly. Some other formats are
acceptable - but formats that include slashes are not among them.
./heLen
>I'd like to insert a date into a DATE column in the dd/mm/yyyy formatIn fact, Firebird doesn't store "formatted" date/time types at all. It
>but FB expects it in the mm/dd/yyyy format. (I get a "convertion error
>from string '15/01/2005'" when I try the INSERT INTO TBL VALUES
>('15/01/2005') statement. (TBL is a table with only one column of type
>DATE).
>
>Interestingly when I retrieve dates which were inserted in the expected
>format (i.e. mm/dd/yyyy), they seem to be stored in the format I want
>(i.e. IBExpert displays them in the dd/mm/yyyy format)
>
>Anyway, I'm just curious if there is an easy way to change the format
>FB accepts date values?
>
>I'm using FB embedded 1.5.2. I'm new to FB and SQL so I'd appreciate
>any help. Thanks!
stores them in a numeric format. When you offer a string as input to a
date/time type, what you are really offering is a date literal. As long as
the parser can make sense of the format of the literal, it can convert this
literal to a date/time type and store it correctly. The reverse process -
the string that gets returned when the Firebird engine retrieves date/time
types is not a question of "inverting" the inward process.
A literal in the format 'dd/mm/ccyy' or 'dd/mm/yy' is NOT one that Firebird
interprets as a valid date. With a slash separator, only 'mm/dd/ccyy' or
'mm/dd/yy' is valid. Hence, your example would mean "the first day of the
15th month" so it is rejected as invalid. '9/01/2005' would be interpreted
as "September 1st".
We who operate beyond the shores of the United States use 'dd.mm.ccyy',
'ccyymmdd', 'ccyy-mm-dd' or 'dd-MMM-ccyy' mostly. Some other formats are
acceptable - but formats that include slashes are not among them.
./heLen