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
 
Back
Top