title: Convert GMT to Local time
body: <p>Edit: This function <em>does</em> work in PHP, it isn't working for me within the CakePHP framework which I didn't think relevant when originally posting.</p>
  
  <p>This function takes a string formatted date/time and a local timezone (e.g. 'America/New_York').  It supposed to return time converted to the local timezone.  Currently, it does not change.</p>
  
  <p>I pass it: '2011-01-16 04:57:00', 'America/New_York' and I get back the same time I pass in.</p>
  
  <pre><code>function getLocalfromGMT($datetime_gmt, $local_timezone){
          $ts_gmt = strtotime($datetime_gmt.' GMT');
          $tz = getenv('TZ');
          // next two lines seem to do no conversion
          putenv("TZ=$local_timezone");
          $ret = date('Y-m-j H:i:s',$ts_gmt);
          putenv("TZ=$tz");
          return $ret;
      }
  </code></pre>
  
  <p>I've seen the references to the new methods for default_timezone_get/set.  I'm not currently interested in using that method because I'd like this code to work with older versions of PHP.</p>