function date_get_timezone_db in Date 7.2
Same name and namespace in other branches
- 8 date_api/date_api.module \date_get_timezone_db()
- 5.2 date_api.module \date_get_timezone_db()
- 6.2 date_api.module \date_get_timezone_db()
- 7.3 date_api/date_api.module \date_get_timezone_db()
- 7 date_api/date_api.module \date_get_timezone_db()
Function to figure out which db timezone applies to a date.
Parameters
string $handling: The timezone handling.
string $timezone: (optional) When $handling is 'date', date_get_timezone_db() returns this value.
Return value
string The timezone string.
23 calls to date_get_timezone_db()
- DateFieldTestBase::createDateField in tests/
DateFieldTestBase.test - Creates a date field from an array of settings values.
- DateFieldTestBase::createMultiDateField in tests/
DateFieldTestBase.test - Creates a date field from an array of settings values.
- date_combo_validate in ./
date_elements.inc - Validate and update a combo element.
- date_context_date_condition::execute in date_context/
plugins/ date_context_date_condition.inc - date_default_value in ./
date_elements.inc - The callback for setting a default value for an empty date field.
File
- date_api/
date_api.module, line 2678 - This module will make the date API available to other modules.
Code
function date_get_timezone_db($handling, $timezone = NULL) {
switch ($handling) {
case 'utc':
case 'site':
case 'user':
// These handling modes all convert to UTC before storing in the DB.
$timezone = 'UTC';
break;
case 'date':
if ($timezone == NULL) {
// This shouldn't happen, since it's meaning is undefined. But we need
// to fall back to *something* that's a legal timezone.
$timezone = date_default_timezone();
}
break;
case 'none':
default:
$timezone = date_default_timezone();
}
return $timezone;
}