What are best practices for handling time zones in PHP when working with date and time functions?

When working with date and time functions in PHP, it's important to handle time zones correctly to ensure accurate date and time calculations. One best practice is to set the default time zone for your PHP script using the date_default_timezone_set() function. This will ensure that all date and time functions operate using the specified time zone.

// Set the default time zone to UTC
date_default_timezone_set('UTC');

// Example usage of date functions with the specified time zone
echo date('Y-m-d H:i:s'); // Outputs the current date and time in UTC