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

Share

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;

*********************************************************************************************************************
Note : Please not do make backups before using these queries and also confirm them yourself or by aother means as
 well.
*********************************************************************************************************************
Share

Comments

comments

Tags: , , , , ,

6 Responses to “ORACLE : How to Show / Get, Year Month and Date between two date ?”

  1. Doogi says:

    Hmm, now this is going to get interesting. One thing for sure Oracle dbasataes and Sun Solaris go together like peanut butter and jelly. I wonder what will happen to their virtualization efforts, since each has a Xen-based hypervisor that has yet to take off.

  2. Sheila says:

    What’s up, after reading this amazing paragraph i am as well glad to share my knowledge here with friends.

  3. suzan says:

    Hi, I do believe this is an excellent website. I stumbledupon it 😉 . Money and freedom is the best way to change, may you be rich and continue to guide other people.

  4. Jack says:

    thanks!!

  5. Tim says:

    Can you share more queries ??

Leave a Reply