note 72522 deleted from function.date-default-timezone-set by nlopess
| From: | nlopess@php.net | Date: | Tue, 23 Jan 2007 12:43:35 +0000 |
| Subject: | note 72522 deleted from function.date-default-timezone-set by nlopess | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-122066@lists.php.net to get a copy of this message | ||
Note Submitter: brentlrussell at gmail dot com
Reason: useless
----
Changing the date for a certain section of your script can be a bit tricky by changing environment
variables. Here is an example of how to change the the timezone and then change it back
$current_dtime = date_default_timezone_get(); // Get the current time and set it to a variable
date_default_timezone_set("America/Chicago"); // Set the timezone to Central time, or
choose another
/*
// do a bunch of stuff here while the timezone is changed
*/
date_default_timezone_set($current_dtime); // Now it is set back to the original timezone
?>