What is the alternative method to DATE_FORMAT() for formatting dates in PHP?

When DATE_FORMAT() is not available or not suitable for formatting dates in PHP, an alternative method is to use the date() function with the strtotime() function to format dates. This allows for more flexibility in formatting options and can be used in situations where DATE_FORMAT() is not available.

$date = "2022-12-31";
$formatted_date = date("Y-m-d", strtotime($date));
echo $formatted_date;