Solved

Deduct Days from Date

Posted on 2002-06-21
10
785 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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
Instantly Create Instructional Tutorials

Contextual Guidance at the moment of need helps your employees adopt to new software or processes instantly. Boost knowledge retention and employee engagement step-by-step with one easy solution.

 
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 9

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

Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

Question has a verified solution.

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

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 informatio…
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…
In this video, viewers will be given step by step instructions on adjusting mouse, pointer and cursor visibility in Microsoft Windows 10. The video seeks to educate those who are struggling with the new Windows 10 Graphical User Interface. Change Cu…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…

630 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