View Full Version : If Statemates and the Date

08-18-2005, 12:22 AM
I'm tring to do what i thought would be a simple task,
just check mysql data base to see if any records are new for today,

If (day(rs2("date_added"))) = (day(date())) Then

both values = 17, so i'm not sure what the problem is.
but the statement seems to think everything in the list being pulled it new. and there should only be about two new items, i checked the table to be sure..

any ideas?

thanks in advance for your time!

08-18-2005, 02:51 AM
Try something like this, it works for MS SQL not sure about My SQL I think dates might get a bit different. In any case it's better to just pull the records you want to begin with.

SQLstr="SELECT * FROM tableName WHERE dateField > '" & formatDateTime(now()-1,2) & " 11:59 PM'"


08-18-2005, 04:03 PM
Lets mysql do this work:

SELECT * FROM tablename where LEFT(datefield,10) = CURDATE()

for yesterday:

SELECT * FROM tablename where LEFT(datefield,10) = DATE_ADD(CURDATE(), INTERVAL -1 DAY)