How can one set the default time zone for a PHP script using date_default_timezone_set()?

To set the default time zone for a PHP script using date_default_timezone_set(), you need to specify the desired time zone using a valid timezone identifier. This function will set the default time zone used by all date and time functions in the script. It's important to set the default time zone to ensure that date and time calculations are accurate and consistent.

<?php
// Set the default time zone to New York
date_default_timezone_set('America/New_York');

// Now all date and time functions will use the New York time zone
echo date('Y-m-d H:i:s');
?>