Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.tools -> Re: how do you find the difference between dates
The results may not be weird..
Subtracting one date from another gives the number of days between the dates; if your dates have a time component then the .6 and .06 may be correct - the minus sign means that you have subtracted in the wrong direction ( so REG_DATE-REAL_S_DATE is probably what you want ) To avoid the time component being involved use TRUNC(REG_DATE) - TRUNC(REAL_S_DATE) "Andy" <andy.konopka_at_camtronics.com> wrote:
>Hello All,
>
>Is there a date difference function in SQL to find the difference between
>a start date and a finish date in a table? I am looking to find out how
>long something took but when I do the following SQL it gives me weird
>results. Do I need to change the date format or use the to_date?
>
>select real_s_date - reg_date from active_separate;
>
>data in table
> WO_NO REG_DATE REAL_S_DA
>---------- --------- ---------
> 2 22-MAR-01 22-MAR-01
> 3 23-MAR-01 22-MAR-01
>
>
>results
>REAL_S_DATE-REG_DATE
>--------------------
> -.06862269
> -.61071759
>
>Would appreciate any help
>
Received on Tue May 01 2001 - 08:44:15 CDT
![]() |
![]() |