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

DateAdd function

Status
Not open for further replies.

deadhead7

Programmer
Apr 18, 2003
57
US
I need to get the total yrs, months, days from a beginning date and ending date. EX:
Begdte:1/1/03
Enddte:2/4/04

should get something like 1yr 1month and 4days
 
Check out the DateDiff function in the Help files.

Good Luck
--------------
As a circle of light increases so does the circumference of darkness around it. - Albert Einstein
 
Hello

Use the DateDiff function to "subtract" one date from another. DateAdd is for adding a specified period to an existing date or time variable.

John
 
Yes use the DateDiff function. But how do I get my results.
 
If you're working on a form, you just need to set the "data" property of the control where you want the results.

Check out thread181-668936 for more information.

Uh, jrbarnett, you can use negative numbers with DateAdd to effect a subtraction.

HTH,
Bob [morning]
 
Deadhead7

Follow CajunCenturion's advice and look up the DateDiff function in the helpfile, then write expressions appropriate to your situation.
Easiest way to get the help up: go into the VBA editor, type
DateDiff (
then use the tooltips to fill in variables or press F1 to load up the context sensitive help.

John
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top