Subject Re: [ib-support] days from January the 1st
Author Ivan Prenosil
> inside a SP, I need to compute the number of days that have elapsed since
> January the 1st of the current year up to a given date (also of the current
> year).
>
> For now, I have been able to write
>
> gg=cast(:d_mov-'2002-01-01' as integer);
>
> but the bluff won't last long... :)

EXTRACT (YEARDAY FROM :d_mov)
or
EXTRACT (YEARDAY FROM CURRENT_TIMESTAMP)

When used with TIMESTAMP, it works for both 1 and 3 dialects.
(DATE type can be used only with dialect 3)

Numbers begin with zero (i.e. January the 2nd returns 1 etc.)

Ivan
http://www.volny.cz/iprenosil/interbase