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

report to tell if a date field is more than 2 days ago

Status
Not open for further replies.

emzadi

IS-IT--Management
Feb 13, 2001
69
US
I need to run a report that will tell if a date in a field is more than 2 days ago. How do I do that? Susan M. Wagner
LAPELS
susanw@lapels.com
 
The DateDiff() function can tell you the difference between two dates and return this difference in any increment you wish.

DaysOld: DateDiff("d", [FirstDate], [SecondDate])
 
Jerry is "correct", but the answer is somewhat limited.

The datediff function returns the number of Intervals (the "d") between the two date arguments.

Consider the following:
DaysOld = DateDiff("d", FirstDate, SecondDate)
? FirstDate, SecondDate, DaysOld
3/21/01 11:59:59 PM 3/23/01 5:47:44 PM 2
3/21/01 12:00:01 AM 3/23/01 5:46:43 PM 2


Although the FirstDate varys by 23H 59M and 58Sec, both differences are 2 days.

So, you need to carefully Know (and DEFINE) the term "two days".


MichaelRed
redmsp@erols.com

There is never time to do it right but there is always time to do it over
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top