Subject | Re: [ib-support] Difference between two dates |
---|---|
Author | Lele Gaifax |
Post date | 2002-11-21T13:31:21Z |
>>>>> On Thu, 21 Nov 2002 13:57:27 +0100, Svein Erling Tysvaer <svein.erling.tysvaer@...> said:SET> At 12:21 21.11.2002 +0000, you wrote:
>> Hi Svein,SET> Oops, sorry - if so, I guess you either have to write a
>>
>> Thanks for your help. I need the result in years, months and
>> days, so, how can I convert the resulting difference in days to
>> years, months and days ?
SET> procedure that does this (could be a bit complicated) or find
SET> a UDF doing it for you (this ought to exist, it should be a
SET> pretty common thing to do)
Uhm, the trick of using a reference date should work. An obvious
choice would be '01/01/01', so you have
SELECT cast('0001-01-01' as date)+:numdays FROM rdb$database
that returns a date value, from that you can EXTRACT the single
elements.
You may have problems passing the ":numdays" param, I cannot try it
right now. If so, you'd need an SP.
ciao, lele.
--
nickname: Lele Gaifax | Quando vivro' di quello che ho pensato ieri
real: Emanuele Gaifas | comincero' ad aver paura di chi mi copia.
email: lele@... | -- Fortunato Depero, 1929.