要將含有 datetime 格式的時間轉換成只有日期的部分,可以透過內建的時間函式轉換:
$date = '2023-02-13 03:09:00'; $createDate = new DateTime($date); $strip = $createDate->format('Y-m-d');
或是使用 explode 處理字串:
$created_at = explode(" ", $order['created_at']); list($date, $time)=$created_at;