Your date format is not valid. From the manual (emphasis mine):
Dates in the m/d/y or d-m-y formats are disambiguated by looking at the separator between the various components: if the separator is a slash (/), then the American m/d/y is assumed; whereas if the separator is a dash (-) or a dot (.), then the European d-m-y format is assumed.
If you're going to use that format you need to be explicit in telling PHP the format of that date. Use DateTime::createFromFormat()
to disambiguate the date format. Also, DateTime objects are comparable which makes your code more readable (and they also handle timezones and daylight savings time which strtotime()
does not do):
$date = DateTime::createFromFormat('d/m/Y', '17/06/2013');
$currentDate = new DateTime();
if($date < $currentDate) {
echo 'date is in the past';
}
else{
echo 'date is in the future';
}