Mar 23, 2001 #1 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
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
Mar 23, 2001 #2 JerryDennison IS-IT--Management Jan 13, 2001 845 US 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]) Upvote 0 Downvote
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])
Mar 23, 2001 #3 MichaelRed Programmer Dec 22, 1999 8,410 US 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 Upvote 0 Downvote
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