What are potential pitfalls when working with multiple time zones in PHP?

When working with multiple time zones in PHP, potential pitfalls include incorrect conversions due to not setting the correct time zone, confusion when handling daylight saving time changes, and inconsistencies when using date functions across different time zones. To solve these issues, it is important to always set the default time zone using the `date_default_timezone_set()` function and use the `DateTime` class for accurate date and time calculations.

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

// Create a DateTime object with a specific time zone
$date = new DateTime('now', new DateTimeZone('America/New_York'));

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