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

Thread: Result of subtracting 2 dates

  1. #1
    Join Date
    Dec 2000
    Posts
    19
    Dear List,
    I want to convert the resultant numeric value of the subtracting 2 date columns in a table.

    Eg:
    select sysdate-joindate from emp

    will result in a numeric value. I want this numeric value to be displayed as a date value.

    Any clues

    TIA

    Venkat


  2. #2
    Join Date
    Oct 2000
    Location
    Germany
    Posts
    1,185
    Can you provide an example?

    What is the result of April 10, 2001 - April 8, 2001 in a date format?
    David Knight
    OCP DBA 8i, 9i, 10g

  3. #3
    Join Date
    Jan 2001
    Posts
    642
    The result of subtracting 2 dates is the number of days.


    1 select to_date('22/10/2001','dd/mm/yyyy') -
    2* to_date('20/10/2001','dd/mm/yyyy') result from dual
    SQL> /

    RESULT
    ---------
    2

    Badrinath

  4. #4
    Join Date
    May 2000
    Posts
    58
    Yor question is how can I display the number 2 as a date ?
    It does not make sense , does it ?

  5. #5
    Join Date
    Oct 2000
    Location
    Germany
    Posts
    1,185
    I agree that the answer is 2.
    David Knight
    OCP DBA 8i, 9i, 10g

  6. #6
    Join Date
    Jun 2000
    Location
    Madrid, Spain
    Posts
    7,447
    or you really mean subtract two dates instead in number of days you want it in months and days

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