note 8931 deleted from function.date by jimw

From: Date: Fri, 02 Nov 2001 00:42:38 +0000
Subject: note 8931 deleted from function.date by jimw
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-20057@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.

« previous php.notes (#20057) next »