testing datetimes

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
cone13cone
Forum Newbie
Posts: 24
Joined: Fri Mar 20, 2009 8:32 pm

testing datetimes

Post by cone13cone »

Im having a rough time with dates in php and mysql, whats the best way to write a query along these lines...
SELECT *
FROM table
WHERE datefield = today

and then
SELECT *
FROM table
WHERE datefield = past 3 days not including today


all my dates are stored in DATETIME format.

Thanks for the help, john
User avatar
jaoudestudios
DevNet Resident
Posts: 1483
Joined: Wed Jun 18, 2008 8:32 am
Location: Surrey

Re: testing datetimes

Post by jaoudestudios »

Take a look at this...http://dev.mysql.com/doc/refman/5.1/en/ ... tions.html
You can use the BETWEEN command too.
pradeep_oscorp
Forum Newbie
Posts: 1
Joined: Wed Apr 01, 2009 2:41 am

Re: testing datetimes

Post by pradeep_oscorp »

No idea abt ii
Post Reply