<html>
  <head></head>
  <body>
<pre><?php
  echo 'Default timezone: ' . date_default_timezone_get() . "\n\n";

  $dateSrc = '2007-04-19 12:50 GMT';
  $dateTime = date_create($dateSrc);
  echo 'Initial time: ' . date_format($dateTime, 'Y-m-d H:i:s') . "\n";
  echo 'Initial timezone: ' . timezone_name_get(date_timezone_get($dateTime)) . "\n";

  $newTimezone = timezone_open ( 'America/Chicago' );
  date_timezone_set( $dateTime, $newTimezone );
  echo 'New time: ' . date_format($dateTime, 'Y-m-d H:i:s') . "\n";
  echo 'New timezone:  ' . timezone_name_get(date_timezone_get($dateTime)) . "\n\n";

  $dateTime = new DateTime($dateSrc);
  echo 'Initial time: ' . $dateTime->format('Y-m-d H:i:s') . "\n";
  echo 'Initial timezone: ' . $dateTime->getTimezone()->getName() . "\n";

  $dateTime->setTimezone( $newTimezone );
  echo 'New time: ' . $dateTime->format('Y-m-d H:i:s') . "\n";
  echo 'New timezone:  ' . $dateTime->getTimezone()->getName() . "\n";

?></pre>
  </body>
</html>
