...

View Full Version : If Statemates and the Date



angst
08-17-2005, 11:22 PM
Hi,
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,

code:
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!
-Ken

Basscyst
08-18-2005, 01: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'"


Basscyst

Cyberlord
08-18-2005, 03: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)


cheers



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum