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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to subtract date

Status
Not open for further replies.

d1004

Programmer
May 9, 2002
78
US
Let say on my form, I ask the user to select only the ending date for the report. Because I want to
control the input, I will compute for the begin quarter date. To do that I need to take the ending date
and subtract that by 3 months to get the begin date. For example: 7/1/2002 - ? = 4/1/2002. Do you know how i can do that? Thank you!
 
=DateDiff("d", [OrderDate], [ShippedDate])

"d" equals days

Bastien

There are many ways to skin this cat,
but it still tastes like chicken
 
Mm, Date diff works if you know both dates, try DateAdd:
Code:
Dim myDate
myDate = DateAdd("m",-3,Now) 'add -3 months to Now
-Tarwn The three most dangerous things in the world are a programmer with a soldering iron, a hardware type with a program patch, and a user with an idea
-computer saying (Wiz Biz - Rick Cook)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top