Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

add days on a date field

Status
Not open for further replies.

specv

Programmer
Aug 8, 2001
42
CA
Hi,

I want to add ex : 10 days on a date and check with another date if the date + 10 days is < other date.

How can I do this (add days) ?

Thanks!

Phil
 
I think it depends on the RDBMS you are using.
In Oracle, something like

SELECT something
FROM somewhere
WHERE (some_date + 10) < comparison_date;

would give you all of the rows where the date + 10 days is less than the comparison date.
 
In Sybase (and probably MS SQL Server) you would use the dateadd function.
Code:
SELECT something
FROM somewhere
WHERE dateadd(dd, 10, some_date) < comparison_date
Greg.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top