I'm having a bit of difficulty determining the number of months between two date columns in my SQLite database. I've checked out this site thoroughly but can't tailor the query to my needs. I am able to check the number of days between dates by subtracting one julianday from another, but months are more complicated.
As an example, I've tried this query:
SELECT strftime('%m','2011-10-10') - strftime('%m','2012-01-01');
This query returns 9, although it should only return 1. I've tried playing around with modifiers and adding formats but can't get it to work the way I need it to.
Any ideas? Thanks!
In other words, I'd like this to work like the DATEDIF(start_date,end_date,"m") function in Excel, which I've seen used in SQL as well.
I got the dates mixed up in my first post, but even if you use 2012-01-01 as the first date and 2011-10-10 as the second, it will give you a difference of -9...

New Topic/Question
Reply



MultiQuote







|