Subject Re: [firebird-support] Convert timestamp to date
Author Helen Borrie
At 04:51 PM 12/09/2003 -0400, you wrote:
>Using FB1.5 dialect 1, I have a number of columns defined as DATE, and
>populated with 'now'.
>
>In a query (or sp), how can I strip the time element from this data,
>allowing me to process just the date portion?
>
>I have tried cast(cast(date_col as integer) as date), but get the
>'conversion error from string...' error message. Cast(date_col as
>char(10)) results in '10-Sep-200', not the hoped for '09/10/2003' that
>would allow a cast back to date.

Dialect 1 doesn't support a date-only type; but you can do this:

dateonly = cast ( cast (
extract (month from date_col) || '/' ||
extract (day from date_col) || '/' ||
extract (year from date_col) || '00:00:00.0000' as string)
as timestamp )

heLen