Sunday, July 11, 2010

PHP Date Comparison?

PHP date comparison, I have a date field in the db stored as YYYY-MM-DD, how can I check (with PHP) and compare with my current date, to see whether the date in the db is older than NOW?

PHP Date Comparison?
Here you go;





%26lt;?php


function dateOlderThanNow($dateFromDB) {


//$dateFromDB is formatted like so: '2005-01-02'





return strtotime($dateFromDB) %26lt; mktime();


}


?%26gt;


No comments:

Post a Comment