• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 806
  • Last Modified:

Deduct Days from Date

Quick question,

Is there a quick function to deduct 5 days from the current date to give the date well... 5 days ago - or do I need to do a deduct on the days then ammend the month/year accordingly?
0
pvernon
Asked:
pvernon
1 Solution
 
pvernonAuthor Commented:
If any help the actual date is not displayed but is used in an SQL statement
0
 
drittichCommented:
What db are you using?
0
 
pvernonAuthor Commented:
SQL Server 7
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
drittichCommented:
Try

SELECT DATEADD(DD, -5, YOUR_DATE) FROM YOUR_TABLE
0
 
MisConFit8Commented:
That will select your date and add 5 to it.  However, if you want to select something that is 5 day ago or 5 days from now in your db, there is a better/cleaner way.  What are you trying to accomplish?
0
 
Nitin SontakkeDeveloperCommented:
As drittich has already pointed out above,

SELECT DateAdd(dd, -5, getDate())

seem to work fine.
0
 
Chandramouli kArchitectCommented:
u can use nextday function, if the db is in oracle.
0
 
Göran AnderssonCommented:
I figured the asp solution should at least be present, this is the asp thread, after all. ;)

datBefore=DateAdd("d", -5, Date())
0
 
Michel SakrCommented:
Simply

GetDate - 5

insert into tableName (zDateField) values (GetDate() - 5)
0
 
pvernonAuthor Commented:
Cool - thks very much!
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now