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;
Source(s):
http://www.php.net/manual
Reply:if ($expiration_date %26lt; NOW())
Yeah NOW() is a function so just use the above.
cosmetic
No comments:
Post a Comment