note 57021 added to function.putenv

From: Date: Wed, 21 Sep 2005 19:58:39 +0000
Subject: note 57021 added to function.putenv
Groups: php.notes 
Request: Send a blank email to php-notes+get-95558@lists.php.net to get a copy of this message
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); } ?> ---- Manual Page -- http://www.php.net/manual/en/function.putenv.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+57021 Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+57021&report=yes&reason=added+to+the+manual Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+57021&report=yes&reason=bad+code Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+57021&report=yes&reason=spam Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+57021&report=yes&reason=useless Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+57021&report=yes&reason=non-english Delete: already in docs -- http://master.php.net/manage/user-notes.php?action=delete+57021&report=yes&reason=already+in+docs Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+57021&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+57021&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#95558) next »