You are here

function date_default_timezone in Date 7.3

Same name and namespace in other branches
  1. 5.2 date_api.module \date_default_timezone()
  2. 6.2 date_api.module \date_default_timezone()
  3. 6 date_api.module \date_default_timezone()
  4. 7 date_api/date_api.module \date_default_timezone()
  5. 7.2 date_api/date_api.module \date_default_timezone()

Returns a timezone name to use as a default.

Parameters

bool $check_user: (optional) Whether or not to check for a user-configured timezone. Defaults to TRUE.

Return value

string The default timezone for a user, if available, otherwise the site.

21 calls to date_default_timezone()
date_default_timezone_object in date_api/date_api.module
Returns a timezone object for the default timezone.
date_default_value_part in ./date_elements.inc
Default value callback to set either 'value', 'value2' to its default value.
date_devel_generate in ./date.devel_generate.inc
Implements hook_devel_generate().
date_field_widget_form in ./date_elements.inc
Private implementation of hook_widget().
date_formatter_process in ./date.module
Helper function for creating formatted date arrays from a formatter.

... See full list

5 string references to 'date_default_timezone'
DateEmwTestCase::setUp in tests/DateEmwTestCase.test
Set up a user and a content type with a Date (ISO) field.
DateMigrateTestCase::testDateImport in tests/DateMigrateTestCase.test
Verify that date fields are imported correctly.
DateTimezoneTestCase::setUp in tests/DateTimezoneTestCase.test
Sets up a Drupal site for running functional and integration tests.
date_api_status in date_api/date_api.module
Helper function to retun the status of required date variables.
date_ical_parse_duration in date_api/date_api_ical.inc
Parses the duration of the event.

File

date_api/date_api.module, line 1972
This module will make the date API available to other modules.

Code

function date_default_timezone($check_user = TRUE) {
  global $user;
  if ($check_user && variable_get('configurable_timezones', 1) && !empty($user->timezone)) {
    return $user->timezone;
  }
  else {
    $default = variable_get('date_default_timezone', '');
    return empty($default) ? 'UTC' : $default;
  }
}