DateAdd question

  • Thread starter Thread starter azu_daioh
  • Start date Start date
A

azu_daioh

I posted this on the wrong group. Reposting for better result.
Thanks.

------------
Im trying to get all the files with any time posted 3 hours earlier
than the current time. I'm using the DateAdd but it does not return
files

DateAdd("h", -3, Date)


So if Date = 06/28/07 04:50pm I want the code to return any files
dated on or before 06/28/07 01:50pm


but for some reason the DateAdd above does not return any files. even
if I have files dated befire 06/28/07 04:50


ref:
.PropertyTests.Add Name:="Last Modified", _
Condition:=msoConditionOnOrBefore, _
Value:=DateAdd("h", -3, Date), _


I could make the code work if I use "d" instead of "h"
I tried changind Date to Time but still no result


I checked the online help and this newsgroup and still couldnt figure
out why I'm not getting any result


Thank you.
 
I posted this on the wrong group. Reposting for better result.
Thanks.

------------
Im trying to get all the files with any time posted 3 hours earlier
than the current time. I'm using the DateAdd but it does not return
files

DateAdd("h", -3, Date)


So if Date = 06/28/07 04:50pm I want the code to return any files
dated on or before 06/28/07 01:50pm


but for some reason the DateAdd above does not return any files. even
if I have files dated befire 06/28/07 04:50


ref:
.PropertyTests.Add Name:="Last Modified", _
Condition:=msoConditionOnOrBefore, _
Value:=DateAdd("h", -3, Date), _


I could make the code work if I use "d" instead of "h"
I tried changind Date to Time but still no result


I checked the online help and this newsgroup and still couldnt figure
out why I'm not getting any result


Thank you.

try this:

WHERE post_date <=DateAdd("n",DateDiff("n",0,Now())-180,0)
 
Hi -
The Date() function doesn't include time. Trying changing it to Now(), e.g.

? dateadd("h", -3, now())

HTH - Bob
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

DateAdd question 1
MS Access Date/Time Calculation After Midnight 1
DateAdd 14
DateAdd question 1
DateAdd 5
DateAdd problem 2
Date/Time Calculations In Query After Midnight 3
Adding minutes 14

Back
Top