My code is as follows:
if(!empty($form_data["birth_date"])){
$date1 = date('d/m/y');
$tempArr = explode('/', $form_data["birth_date"]);
$date2 = date("d/m/y", mktime(0, 0, 0, $tempArr[1] ,$tempArr[0], $tempArr[2]));
}
if(strtotime($date2) >= strtotime($date1))
echo "Please enter date which is not greater than today's date!!!";
I'm getting the error message even after entering the date less than today's date. I'm using dd/mm/yyyy format. Can anyone help me please? Thanks in advance.
$date1 = 20/12/2013;
$date2 = 21/03/1985;
strtotime function is used to date format YYYY/MM/DD so please convert date this formate and then apply strtotime() and after compare two dates