note 57021 rejected from function.putenv by danbrown

From: Date: Sun, 20 Jul 2008 01:02:41 +0000
Subject: note 57021 rejected from function.putenv by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-141881@lists.php.net to get a copy of this message
Note Submitter: Eric Z <ezsomething at notthere dot com> ---- Hello, actually in answer to your question, I use putenv regularly to control the timezone info. Here's the code that sets both the local environment and SQL to the right timezone. I also use it when running a cvs client through the web. I will post what format it's looking for next. <?php //this isn't the most graceful approach, but if it's set, set the tz if (isset($_SESSION[BEE_PROFILE_TZOFFSET])) { putenv('TZ='.$_SESSION[BEE_PROFILE_TZOFFSET]); //format the timezone for SQL $timeZone = preg_replace('/([+-]\d{2})(\d{2})/', '\'\1:\2\'', date('O')); mysql_query('SET time_zone='.$timeZone); } ?>

« previous php.notes (#141881) next »