DrupalDateTime::prepareTimezone

protected DrupalDateTime::prepareTimezone($timezone)

Overrides prepareTimezone().

Override basic component timezone handling to use Drupal's knowledge of the preferred user timezone.

Overrides DateTimePlus::prepareTimezone

File

core/lib/Drupal/Core/Datetime/DrupalDateTime.php, line 67

Class

DrupalDateTime
Extends DateTimePlus().

Namespace

Drupal\Core\Datetime

Code

protected function prepareTimezone($timezone) {
  if (empty($timezone)) {
    // Fallback to user or system default timezone.
    $timezone = drupal_get_user_timezone();
  }
  return parent::prepareTimezone($timezone);
}
doc_Drupal
2016-10-29 09:02:53
Comments
Leave a Comment

Please login to continue.