What is the recommended way to handle time zones and daylight saving time in PHP date functions?

Handling time zones and daylight saving time in PHP date functions can be done by setting the default time zone using `date_default_timezone_set()` function and using the `DateTime` class for date manipulation. This ensures that the dates and times are correctly adjusted based on the specified time zone and automatically accounts for daylight saving time changes.

// Set the default time zone to the desired one
date_default_timezone_set('America/New_York');

// Create a new DateTime object with the current date and time
$date = new DateTime();

// Format the date in the desired format
echo $date->format('Y-m-d H:i:s');