Fowler, Jeff wrote:
Hello All,
SQLite newbie here. I've looked through the email archives and website
trying to find out how to compute the difference in months between two
given dates. Each date is in YYYY-MM-DD HH:MM:SS format.
The best I've been able to come up with seems rather ugly: SELECT (strftime( '%Y', date1)*12+strftime('%m',date1)) -
(strftime('%Y',date1)*12+strftime('%m',date1))
Am I on the right track, or is there something obvious I'm missing? Thanks in advance, Jeff Fowler
For the other query you reported in a later mail

WHERE (strftime('%Y', LaborEndDate)*12+strftime('%m', LaborEndDate)) - 
(strftime('%Y', LaborStartDate)*12+strftime('%m', LaborStartDate)) < 3


I'm using something like this:
WHERE (date(date1, '+3 months') > date(date2))

Paolo

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

Reply via email to