Subject | Re: [firebird-support] Re: date functions in FB |
---|---|
Author | Ivan Prenosil |
Post date | 2005-12-13T11:26:31Z |
>> > So adding a day would be as simple as:E.g. adding one year:
>> >
>> > Select MyDate + 1
>> > From MyTable;
>> > From there, you should be able to figure out the rest.
>>
>> Adding years is not obvious at all. Years can contain different number
>> of days and there should be functions to handle that....Why the FB SQL
>> is so poor? I remember doing this with MS SQL very easily..
>>
>
> Select (MyDate + (365.2525 * :NumOfYears)
>
> This will fail in CE 3000
> Come back to me then (or just before) and I'll give a suitable workaround.
SELECT (CAST('2004-1-10' AS DATE) + (365.2525 * 1)) FROM RDB$DATABASE;
==========
2005-01-09
SELECT (CAST('2003-12-10' AS DATE) + (365.2525 * 1)) FROM RDB$DATABASE;
==========
2004-12-09
Is this result what you expect ?
Ivan