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
You could try this to find out which one is the start date.
select to_char(real_s_date ,'DDMMYYYY HH24MISS'),
to_char(reg_date,'DDMMYYYY HH24MISS') from active_separate;
you will then be able to easily differentiate the start date from the end date.
Eric Pearson
eric.pearson_at_ssss.gouv.qc.ca
Andy <andy.konopka_at_camtronics.com> a écrit dans le message :
FHyH6.1393$A07.341309_at_homer.alpha.net...
> 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:26:27 CDT