Ask a Question
Advertise on boostr.in
Organizational Research By
Surprising Reserch Topic
Experts Most Trusted Topic
get the difference between two dates both in months and days in sql
get the difference between two dates both in months and days in sql ¬†using -'sql,oracle,date-arithmetic'
I need to get the difference between two dates say if the difference is 84 days, I should probably have output as 2 months and 14 days, the code I have just gives the totals. Here is the code
SELECT Months_between(To_date('20120325', 'YYYYMMDD'),
¬†¬†¬†¬†¬†¬†¬†( To_date('20120325', 'YYYYMMDD') - To_date('20120101', 'YYYYMMDD') )
I need for example the output for this query to be either 2 months and 14 days at worst, otherwise I won't mind if I can have the exact days after the months figure because those days are not really 14 because all months do not have 30 days.
Sep 24, 2015
to add a comment.
Related Hot Questions
Government Jobs Opening