string - Compare current date with a date in d/mm/yyyy format in PHP -
what best way check if given date - string d/mm/yyyy past? when used strtotime(), didn't work well, because of non-american notation. of course might deal dates strings , compare substrings, there has better way.
if((strtotime('now')-strtotime($date)) > 86400) echo $date;
dates in m/d/y or d-m-y formats disambiguated looking @ separator between various components: if separator slash (/), american m/d/y assumed; whereas if separator dash (-) or dot (.), european d-m-y format assumed.
strtotime() manual
so simple str_replace('/', '-', $date)
should trick.
Comments
Post a Comment