I have a date value posted from php using jquery (MMDDYYYY)and i want to convert this date format to YYYYMMDD using php .
$fromDate=str_replace("'","''",trim($_POST['tx_fromDateDsp']));
echo "-->".$year = substr($fromDate, 6, 4)."<br>";
echo "-->".$month = substr($fromDate, 0, 2)."<br>";
echo "-->".$date = substr($fromDate, 3, 2)."<br>";
echo $new_date = date( 'Ymd', strtotime($month, $date, $year ));
Suppose in the above code I have entered date as '070122010'.The new_date at the down gives me '20100714' . I dont know why it is giving todays Date .I have tried both the mktime and strtotime both are giving same result .Iam expecting as '20100712'(YYYYMMDD)