DBAsupport.com Forums - Powered by vBulletin
Results 1 to 4 of 4

Thread: Date Fuction

  1. #1
    Join Date
    Mar 2002
    Posts
    25

    Unhappy

    Hi All

    is the a date fuction I can use to get the a number of days between two date variables.
    e.g number of days between 02-APR-02 and 03-APR-02.

    Thanx

  2. #2
    Join Date
    Jun 2001
    Location
    Helsinki. Finland
    Posts
    3,938
    How about the minus (-) function :-)

    Code:
    SQL> select to_date('03.04.2002','dd.mm.yyyy')-to_date('02.04.2002','dd.mm.yyyy') DAYS from dual;
    
          DAYS
    ----------
             1
    
    SQL>
    Oracle Certified Master
    Oracle Certified Professional 6i,8i,9i,10g,11g,12c
    email: ocp_9i@yahoo.com

  3. #3
    Join Date
    Nov 2000
    Location
    greenwich.ct.us
    Posts
    9,092
    Date subtraction...
    Code:
      1  select
      2  to_date('02/02/2002','mm/dd/yyyy') - to_date('03/04/2002','mm/dd/yyyy') date_diff
      3* from dual
    SQL> /
    
     DATE_DIFF
    ----------
           -30
    Jeff Hunter

  4. #4
    Join Date
    Jan 2002
    Location
    Netherlands
    Posts
    1,587
    SQL> select trunc(sysdate-to_date('20/03/02','dd/mm/yy')) "Diff"
    2 from dual;

    Diff
    ----------
    14
    Tarry Singh
    I'm a JOLE(JavaOracleLinuxEnthusiast)
    TarryBlogging
    --- Everything was meant to be---

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Click Here to Expand Forum to Full Width