Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: equivalent DataDiff function?
A copy of this was sent to wykoff_at_my-deja.com
(if that email address didn't require changing)
On Thu, 24 Jun 1999 18:11:29 GMT, you wrote:
>In article <37764d2a.66700410_at_newshost.us.oracle.com>,
> tkyte_at_us.oracle.com wrote:
>
>> date arithmetic is so trivial that a specialized function like
>datediff is not
>> needed. Just subtract. You get the difference in days. Multiply by
>24 --
>> hours, multiply by 60 minutes, multiply by 60 -- seconds.
>>
>
>Wow, that was awesome. Thanks so much. Why, oh why can't I find this
>documented?
>
>kim
>
>
>Sent via Deja.com http://www.deja.com/
>Share what you know. Learn what you don't.
from the oracle7 "sql reference" manual. (same place in the o8 docs as well)
chapter 2 - elements of oracle7 sql
section on datatypes/Date datatype:
<quote>
DATE Datatype
The DATE datatype is used to store date and time information.
Although date and time information can be represented in both CHAR
and NUMBER datatypes, the DATE datatype has special associated
properties.
For each DATE value the following information is stored:
century
year
month
day
hour
minute
second
To specify a date value, you must convert a character or numeric value to a data value with the TO_DATE function. Oracle7 automatically converts character values that are in the default date format into date values when they are used in date expressions. The default date format is specified by the initialization parameter NLS_DATE_FORMAT and is a string such as DDMONYY. This example date format includes a twodigit number for the day of the month, an abbreviation of the month name, and the last two digits of the year.
If you specify a date value without a time component, the default time is 12:00:00a.m. (midnight). If you specify a date value without a date, the default date is the first day of the current month. The date function SYSDATE returns the current date and time. For information on the SYSDATE and TO_DATE functions and the default date format, see Chapter 3 Operators, Functions, Expressions, Conditions of this manual.
Date Arithmetic
Oracle7 provides functions for many of the common date operations. For example, the ADD_MONTHS function allows you to 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 31day month. For more information on date functions, see the section Date Functions on page 3 37.
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.
Using Julian Dates
2448623
</quote>
--
See http://govt.us.oracle.com/~tkyte/ for my columns 'Digging-in to Oracle8i'...
Current article is "Part I of V, Autonomous Transactions" updated June 21'st
Thomas Kyte tkyte_at_us.oracle.com Oracle Service Industries Reston, VA USA
Opinions are mine and do not necessarily reflect those of Oracle Corporation Received on Thu Jun 24 1999 - 13:36:05 CDT
![]() |
![]() |