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
Replace / with -:
$date1 = strtr($_REQUEST['date'], '/', '-');
echo date('Y-m-d', strtotime($date1));
Use below code for php 5.3+:
$date = new DateTime('1900-02-15');
echo $date->format('Y-m-d');
Use below code for php 5.2:
$date = new DateTime('1900-02-15');
echo $date->format('Y-m-d');