"RB Smissaert" <[EMAIL PROTECTED]> wrote:
> Is it possible with Julian dates in 2 fields to calculate the months and/or
> years difference between those 2 dates?
>
> I know I can subtract the 2 dates and divide by 30 (or 30.42) or 365 and
> take it from there, but I would like it a bit more precise, so for example:
> Is 2 March 2006 more than one month after 1 February 2006?
> If calculated with a simple division the answer would be no, but I would
> like it to be yes.
>
> Had a look at the date/time functions on the WIKI site, but couldn't see it.
>
If you have two dates A and B, you can ask the question:
Is A more than one month after B like this:
SELECT julianday(A,'+1 month')>B ...
If you really need to know the number of months difference between
A and B, then perhaps something like this:
SELECT (strftime('%m',A)+12*strftime('%Y',A)) -
(strftime('%m',B)+12*strftime('%Y',B)) ...
Caution: Both of the above are off the top of my head and are
untested. But perhaps they will give you some ideas.
--
D. Richard Hipp <[EMAIL PROTECTED]>
-----------------------------------------------------------------------------
To unsubscribe, send email to [EMAIL PROTECTED]
-----------------------------------------------------------------------------