How can PHP's date function be utilized to format dates in a specific way?

To format dates in a specific way using PHP's date function, you can specify the desired format using format characters such as 'Y' for the year, 'm' for the month, 'd' for the day, 'H' for the hour, 'i' for the minutes, 's' for the seconds, and more. By combining these format characters in a string, you can create a custom date format that suits your needs.

$date = "2022-10-15 14:30:00";
$formatted_date = date("Y-m-d H:i:s", strtotime($date));
echo $formatted_date;