I have a form in which date format is dd/mm/yyyy . For searching database , I hanverted the date format to yyyy-mm-dd . But when I echo
dd/mm/yyyy
yyyy-mm-dd
echo
$date1 = $_REQUEST['date']; if($date1) { $date1 = date( 'Y-m-d', strtotime($date1)); } else { $date1 = ''; }
This will display properly when there is a valid date() in $date and display nothing if not. Solved the issue for me.
date()
$date