Subject Re: [firebird-support] Valid formats for datetime
Author Helen Borrie
At 08:42 AM 4/05/2005 -0400, you wrote:
>I'm trying to concatenate two columns that contain varchar
>information, one for date and one for time.
>
>I can't seem to figure out what FB 1.5 will accept for automatic
>conversion to a DATE data type (dialect 1).
>
>Give a varchar of '5/1/2005' and '10:00 AM', how can I concatenate the
>two into a DATE column?
>
>A simple '5/1/2005' || ' ' || '10:00 AM' does not work (conversion
>error).

First, Firebird doesn't know about AM and PM. The time part of a Firebird
literal is airline time.
Secondly, it's not valid to include a time part in a DATE column. It needs
to be TIMESTAMP.
Thirdly, because it is an expression, you need a cast:

cast ('5/1/2005' || ' ' || '10:00:00.0000' as timestamp)

If you do only want a DATE type:

cast ('5/1/2005' as date)

There are other valid formats for date literals, e.g. '1.5.2005' or
'1-MAY-2005', but only one for time-parts.

./hb