Solved

Deduct Days from Date

Posted on 2002-06-21
10
771 Views
Last Modified: 2011-09-20
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
Comment
Question by:pvernon
10 Comments
 

Author Comment

by:pvernon
ID: 7098900
If any help the actual date is not displayed but is used in an SQL statement
0
 
LVL 8

Expert Comment

by:drittich
ID: 7098930
What db are you using?
0
 

Author Comment

by:pvernon
ID: 7098948
SQL Server 7
0
VMware Disaster Recovery and Data Protection

In this expert guide, you’ll learn about the components of a Modern Data Center. You will use cases for the value-added capabilities of Veeam®, including combining backup and replication for VMware disaster recovery and using replication for data center migration.

 
LVL 8

Accepted Solution

by:
drittich earned 100 total points
ID: 7099029
Try

SELECT DATEADD(DD, -5, YOUR_DATE) FROM YOUR_TABLE
0
 

Expert Comment

by:MisConFit8
ID: 7099646
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
 
LVL 6

Expert Comment

by:Nitin Sontakke
ID: 7099704
As drittich has already pointed out above,

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

seem to work fine.
0
 
LVL 5

Expert Comment

by:kcm76
ID: 7100266
u can use nextday function, if the db is in oracle.
0
 
LVL 29

Expert Comment

by:Göran Andersson
ID: 7100388
I figured the asp solution should at least be present, this is the asp thread, after all. ;)

datBefore=DateAdd("d", -5, Date())
0
 
LVL 20

Expert Comment

by:Silvers5
ID: 7100392
Simply

GetDate - 5

insert into tableName (zDateField) values (GetDate() - 5)
0
 

Author Comment

by:pvernon
ID: 7101617
Cool - thks very much!
0

Featured Post

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

I have helped a lot of people on EE with their coding sources and have enjoyed near about every minute of it. Sometimes it can get a little tedious but it is always a challenge and the one thing that I always say is:  The Exchange of information …
Have you ever needed to get an ASP script to wait for a while? I have, just to let something else happen. Or in my case, to allow other stuff to happen while I was murdering my MySQL database with an update. The Original Issue This was written…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

831 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question