Quantcast
Channel: SCN : Unanswered Discussions - Data Services and Data Quality
Viewing all articles
Browse latest Browse all 3719

Convert No. of days to year and month.

$
0
0

Hi Experts,

 

I have a scenario where i need to calculate No. of years and No. of months between 2 dates.

 

I have calculated no of days between 2 dates using this conversion.

 

interval_to_char(sysdate()-PURCHASE_DT,'D')

 

For eg. Suppose no of days is 765 then in YEAR column 2 should be mapped and in MONTH column 1 should be mapped.

 

No. of Days  Year   Month

765              2        1

 

 

For Year i have used this:

floor(cast(interval_to_char(sysdate()-PURCHASE_DT,'D'),'INT')/365)

 

Please help me with Month Column.

 

Thanks

Neha Khetan


Viewing all articles
Browse latest Browse all 3719

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>