Sybernet / Supplied Functions Reference
Release 3.00
Oct 14, 2002
backwards forwards

HTTP.DATEDIFF

The datediff function calculates the amount of time in date parts between the second and first of two dates you specify--in other words, it finds an interval between two dates. The result is a signed integer value equal to date2 - date1, in dateparts.

Syntax

FUNCTION DATEDIFF
(
    DATEPART                      VARCHAR2
,   DATETIME1                     DATE
,   DATETIME2                     DATE
)
RETURN NUMBER;

Parameters

Parameter Description
datepart
 
Date Part     Abbreviation   Values
------------- -------------- ---------------------------------
year          yy             1753 - 9999
quarter       qq             1 - 4
month         mm             1 - 12
dayofyear     dy             1 - 366
day           dd             1 - 31
week          wk             1 - 54
weekday       dw             1 - 7 (1 is Sunday in us_english)
hour          hh             0 - 23
minute        mi             0 - 59
second        ss             0 - 59
datetime1
 
A date value./td>
datetime2
 
A date value.

Returns

The amount of time between the second and first of two dates, converted to the specified date part.

Example

The following example illustrates how to calculate the number of days between October 17, 1999 and today.

select http.datediff('day',http.datetime('October 17, 1999'),sysdate) from dual;



Sybernet is a trademark of SRI International.
Copyright © 1996-2008 SRI International. All Rights Reserved.
Denis D. Workman / http://Sybernet.sri.com/