How can the DateTime class be utilized in PHP to efficiently handle date calculations and formatting, especially when dealing with different time zones?

When dealing with date calculations and formatting in PHP, especially across different time zones, the DateTime class can be utilized to efficiently handle these tasks. By creating DateTime objects with the appropriate time zone set, you can accurately perform calculations and conversions without worrying about time zone discrepancies. Additionally, the DateTime class provides methods for formatting dates according to specific requirements.

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

// Perform date calculations or formatting
$date->modify('+1 day');
echo $date->format('Y-m-d H:i:s');