fork download
  1. <?php
  2.  
  3. $tz = date_default_timezone_get(); // or your timezone of choice
  4. $dt = new DateTime;
  5. $dtz = new DateTimeZone($tz);
  6. $off = $dtz->getOffset($dt);
  7. $s = $off >= 0;
  8. $h = abs(floor($off / 3600));
  9. $m = abs($off % 3600);
  10.  
  11. printf("(GMT%s%02d:%02d) %s", $s ? '+' : '-', $h, $m, $tz);
Success #stdin #stdout 0.02s 13112KB
stdin
Standard input is empty
stdout
(GMT+00:00) Europe/London