How can PHP developers test and troubleshoot timestamp functionality in their code to account for time changes like daylight saving time without access to a server for time adjustments?

When testing and troubleshooting timestamp functionality in PHP code to account for time changes like daylight saving time without access to a server for time adjustments, developers can use the DateTime class along with the DateTimeZone class to handle time zone conversions and daylight saving time adjustments programmatically.

// Create a DateTime object with the desired timestamp and timezone
$timestamp = '2022-03-13 12:00:00';
$timezone = new DateTimeZone('America/New_York');
$date = new DateTime($timestamp, $timezone);

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