note 8931 added to date
| From: | dont at mail dot me | Date: | Fri, 06 Oct 2000 10:57:26 +0000 |
| Subject: | note 8931 added to date | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-6158@lists.php.net to get a copy of this message | ||
Here is the code I used to get dates in different timezones displaying properly. I use my own
Timezone database for this as I need to keep it more up to date than the OS developers do.
Here is the code I used to get it to work:
// Save the old Timezone
$old_tz = getenv("TZ");
// Setup the new timezone
$new_tz = $timezone;
// set the Timezone
putenv("TZ=$new_tz");
$timestamp=mktime($hour,$minutes,$seconds,$month,$day,$year);
// Show the time
echo ' ' . date("d/m/Y H:i:s T");
// Now restore the old Timezone
putenv("TZ=$old_tz");
In the previous notes someone used the data function like date("d/m/Y H:i:s T",
$timestamp);
If I did this I would get a time of zero, but if I run it without the timestamp parameter it works.
But if I get rid of the timestamp=... line then date will just return the local time as set by my
machine???
Here are the URL's to THE definitive lists of timezone and country info:
http://www.din.de/gremien/nas/nabd/iso3166ma/codlstp1/db_en.html
ftp://elsie.nci.nih.gov/pub/
The last one has the reference date and time c code and all the timezone files.
http://www.php.net/manual/function.date.php