Hire me on UpWork

Wednesday, November 30, 2011

How to Show / Get, Year Month and Date between two date ?

 Use bellow sql to show year month and date..
   
    SELECT    TRUNC (MONTHS_BETWEEN (:END_DATE, :START_DATE) / 12) as YEARS,
MOD(TRUNC (MONTHS_BETWEEN (:END_DATE, :START_DATE)), 12) as MONTHS,
            (  TO_DATE (:END_DATE)- ADD_MONTHS (:START_DATE,TRUNC (MONTHS_BETWEEN (:END_DATE, :START_DATE))))  as Date
      FROM DUAL;

No comments:

Post a Comment