Subject | Re: [ib-support] days from January the 1st |
---|---|
Author | Helen Borrie |
Post date | 2002-03-02T10:46:30Z |
At 10:56 AM 02-03-02 +0100, you wrote:
gg = :d_mov - cast('2002-01-01' as date);
If :d_mov is a timestamp you'll have to do this:
gg = cast(:d_mov as date) - cast('2002-01-01' as date);
cheers,
Helen
All for Open and Open for All
Firebird Open SQL Database ยท http://firebirdsql.org
_______________________________________________________
>inside a SP, I need to compute the number of days that have elapsed sinceIt's not far out:
>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... :)
>
>Any hint ?
gg = :d_mov - cast('2002-01-01' as date);
If :d_mov is a timestamp you'll have to do this:
gg = cast(:d_mov as date) - cast('2002-01-01' as date);
cheers,
Helen
All for Open and Open for All
Firebird Open SQL Database ยท http://firebirdsql.org
_______________________________________________________