How can PHP code be used to set and display the correct timezone for date and time functions?

When working with date and time functions in PHP, it is important to set the correct timezone to ensure accurate date and time calculations and display. This can be achieved by using the `date_default_timezone_set()` function to specify the desired timezone. Once set, all date and time functions in the script will use the specified timezone for calculations and display.

// Set the timezone to 'America/New_York'
date_default_timezone_set('America/New_York');

// Display the current date and time in the specified timezone
echo date('Y-m-d H:i:s');