What potential issues could arise when manipulating dates in PHP, especially with database interactions?

One potential issue when manipulating dates in PHP, especially with database interactions, is handling time zones correctly. To ensure consistency and accuracy, it is important to store dates in the database in a standardized format, such as UTC, and convert them to the appropriate time zone when displaying to the user.

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

// Get the current date and time in UTC
$current_date_time = gmdate('Y-m-d H:i:s');

// Convert the UTC date and time to a specific time zone
$timezone = new DateTimeZone('America/New_York');
$date_time = new DateTime($current_date_time);
$date_time->setTimezone($timezone);

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