php - How to formate variable returned as /Date(1465196400000)/ into a real date -
i pulling api, variables startdate , enddate return /date(1465196400000)/, can advise best approach format real date such mm/dd/yy?
the /date throwing me off.
here how can convert date using preg_match:
$data = '/date(1465196400000)/'; if (preg_match('#/date\((\d+)\)/#', $data, $result)) { $date = date('d-m-y', $result[1] / 1000); echo $date; // 06-06-2016 };
Comments
Post a Comment