Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: newby sql question: adding time

Re: newby sql question: adding time

From: Scott Mattes <Scott_at_TheMattesFamily.ws>
Date: Wed, 25 Jun 2003 15:17:00 GMT
Message-ID: <M1jKa.17404$Jw6.7203833@news1.news.adelphia.net>


Oracle date fields are a combination of days since some point in time and the fraction of a day since midnight.

The following is from the online docs (SQL Reference, DATE Datatype) at tahiti.oracle.com

Date Arithmetic
You can add and subtract number constants as well as other dates from dates. Oracle interprets number constants in arithmetic date expressions as numbers of days. For example, SYSDATE + 1 is tomorrow. SYSDATE - 7 is one week ago. SYSDATE + (10/1440) is ten minutes from now. Subtracting the hiredate column of the emp table from SYSDATE returns the number of days since each employee was hired. You cannot multiply or divide DATE values.

Oracle provides functions for many common date operations. For example, the ADD_MONTHS function lets you add or subtract months from a date. The MONTHS_BETWEEN function returns the number of months between two dates. The fractional portion of the result represents that portion of a 31-day month.

Because each date contains a time component, most results of date operations include a fraction. This fraction means a portion of one day. For example, 1.5 days is 36 hours.

"Peter Verschueren" <peter.verschueren_at_transavia.nl> wrote in message news:3ef9baec$0$13800$4d4ebb8e_at_news.nl.uu.net...
> how do i add a number representing total of minutes to a date:
200(minutes)
> to 24-06-03 14:00:00 would make
> 24-06-03 17:20
>
> thanks
>
> peter
>
>
Received on Wed Jun 25 2003 - 10:17:00 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US