Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Deduct Days from Date

Posted on 2002-06-21
10
Medium Priority
?
805 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
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 8

Accepted Solution

by:
drittich earned 400 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 11

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:Michel Sakr
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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

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…
Hello, all! I just recently started using Microsoft's IIS 7.5 within Windows 7, as I just downloaded and installed the 90 day trial of Windows 7. (Got to love Microsoft for allowing 90 days) The main reason for downloading and testing Windows 7 is t…
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …
Despite its rising prevalence in the business world, "the cloud" is still misunderstood. Some companies still believe common misconceptions about lack of security in cloud solutions and many misuses of cloud storage options still occur every day. …
Suggested Courses
Course of the Month10 days, 5 hours left to enroll

926 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