PHP compare dates [duplicate]
Possible Duplicate: php date compare I have a date that I take from the mySQL database that looks like this: 2011-06-20 And I get the date of the current day in this way: $todaydate = date('Y-m-d'); What I need to know is how do I compare the two results? How can I compare the dates and understand for example if a week is passed from the database date or a month or a year..etc..? Thank you!! There is no need to put that burden on PHP when MySQL has built-in functionality for that already. You should take a look at MySQL's DATEDIFF() function: DATEDIFF() returns expr1 – expr2 expressed as a