1 date.inc date_timezone_is_valid($timezone)

Determines if a timezone string is valid.

Parameters

string $timezone: A potentially invalid timezone string.

Return value

bool: TRUE if the timezone is valid, FALSE otherwise.

File

core/includes/date.inc, line 775
Date API functions.

Code

function date_timezone_is_valid($timezone) {
  static $timezone_names;
  if (empty($timezone_names)) {
    $timezone_names = array_keys(date_timezone_names(TRUE));
  }
  return in_array($timezone, $timezone_names);
}