I have a DATETIME column that stores values such as:
2012-05-20 14:00:00
How do I compare the date in $row['Date'] with current date (time is not important) to see if it’s older than today?
if($row['Date'] < ...) {
echo 'date has passed'
}
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Why not have SQL do the comparison for you?
Then you’ve got a column called ‘is_old’ which is 1 if the date is before today and 0 if it’s not. So, in PHP, all you need to do is something like: