Last active
April 6, 2017 10:28
-
-
Save gchacaltana/8477694 to your computer and use it in GitHub Desktop.
checking timezone
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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; | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
very well thanks!!