Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: datediff
"Jean" <ken_jean_at_hotmail.com> a écrit dans le message news: 9nptaf$t3i$1_at_serv1.iunet.it...
> Hi to all!!!
> I'm new in oracle.
> I need to have a difference between current date and a datetime field that I
> have in a table.
> How I can do this?
> In SQL Server exist a function called DateDiff that make this.
> And in Oracle what is solution?
>
> Thanks a lot in advance.
> Bye
>
With Oracle there is - (minus):
date2-date1=nb of days between the two dates (float number).
For example, nb of days since beginning of the year:
v817>select to_date('13/09/2001 11:56:10','DD/MM/YYYY HH24:MI:SS') 2 -to_date('01/01/2001 00:00:00','DD/MM/YYYY HH24:MI:SS') diff 3 from dual;
DIFF
-- Have a nice day MichelReceived on Thu Sep 13 2001 - 04:58:36 CDT