I am trying to convert a date from yyyy-mm-dd to dd-mm-yyyy (but not in SQL); however I don\'t know how the date function requires a timestamp, and
yyyy-mm-dd
dd-mm-yyyy
Simple way Use strtotime() and date():
strtotime()
date()
$original_dateTime = "2019-05-11 17:02:07"; #This may be database datetime $newDate = date("d-m-Y", strtotime($original_dateTime));
With time
$newDate = date("d-m-Y h:i:s a", strtotime($original_dateTime));