Fowler, Jeff wrote:
Yes - I've looked over the current date functions. I would propose a
single function addition that's hugely valuable in the business world.
SQL Server has a function called "datediff" for date arithmetic. It
accepts three parameters. The first indicates the unit of scale (years,
months, weeks, days, etc. - I think it even goes into milliseconds!).
The next two parameters are the dates to compute the difference between.
It returns an integer.

I don't think you answered Richard's original question. What constitutes a month? Since month lengths vary, there is no exactly science to "how many months between these two dates." Otherwise your best bet is what he already recommended.

SELECT (julianday(date2) - julianday(date1)) / 30.43666 AS Months;

--
Scott Baker - Canby Telcom
RHCE - System Administrator - 503.266.8253

-----------------------------------------------------------------------------
To unsubscribe, send email to [EMAIL PROTECTED]
-----------------------------------------------------------------------------

Reply via email to