Skip to content

Instantly share code, notes, and snippets.

@gchacaltana
Last active April 6, 2017 10:28
Show Gist options
  • Save gchacaltana/8477694 to your computer and use it in GitHub Desktop.
Save gchacaltana/8477694 to your computer and use it in GitHub Desktop.
checking timezone
<?php
/**
* return true if timezone exist.
* @author Gonzalo Chacaltana Buleje <gchacaltanab@outlook.com>
* @param string $timezone, timezone. example: America/Lima
*/
public static function checkTimeZone($timezone)
{
if (!empty($timezone)) {
$listTimeZone = DateTimeZone::listIdentifiers(DateTimeZone::ALL);
foreach ($listTimeZone as $row) {
if ($row === $timezone) {
return true;
}
}
}
return false;
}
?>
@kusflo
Copy link

kusflo commented Apr 6, 2017

very well thanks!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment