1. Get rid of all advertisements and get unlimited access to documents by upgrading to Premium Membership. Upgrade to Premium Now and also get a Premium Badge!

date manipultation reg

Discussion in 'SQL PL/SQL' started by laxman, Jan 5, 2010.

  1. laxman

    laxman Forum Expert

    Messages:
    144
    Likes Received:
    0
    Trophy Points:
    230
    Location:
    MUMBAI
    Dear all,
    i need different output from this query mentioned below.
    suppose i have execute this query.

    sql> select add_month(SYSDATE, -1 * 6) finaldate from dual;

    it will give the output as

    sql>FINALDATE
    -----------------
    05-JUL-2009 13:46

    now i need to get the total no days from the same query that means it should calculate the total no of days from july to current date and give the output.

    if you can give any hint.

    Regards
    Laxman
     
  2. zargon

    zargon Community Moderator Forum Guru

    Messages:
    2,347
    Likes Received:
    348
    Trophy Points:
    1,430
    Location:
    Aurora, CO
    You can't subtract the calculated result from SYSDATE?
     
  3. PauloMontiel

    PauloMontiel Guest


    1. add_months
    2. -6. No reason to use -1*6.
    3. SELECT TRUNC(SYSDATE - ADD_MONTHS(TRUNC(SYSDATE, 'SYYYY'), 5), 0) DAYS_TO_0106 FROM DUAL
     
  4. laxman

    laxman Forum Expert

    Messages:
    144
    Likes Received:
    0
    Trophy Points:
    230
    Location:
    MUMBAI
    Thanks a lot sir for helping me in solving this issue.

    Regards
    Laxman