function DateTimePlus::setDefaultDateTime

Same name in other branches
  1. 8.9.x core/lib/Drupal/Component/Datetime/DateTimePlus.php \Drupal\Component\Datetime\DateTimePlus::setDefaultDateTime()
  2. 10 core/lib/Drupal/Component/Datetime/DateTimePlus.php \Drupal\Component\Datetime\DateTimePlus::setDefaultDateTime()
  3. 11.x core/lib/Drupal/Component/Datetime/DateTimePlus.php \Drupal\Component\Datetime\DateTimePlus::setDefaultDateTime()

Sets the default time for an object built from date-only data.

The default time for a date without time can be anything, so long as it is consistently applied. If we use noon, dates in most timezones will have the same value for in both the local timezone and UTC.

File

core/lib/Drupal/Component/Datetime/DateTimePlus.php, line 712

Class

DateTimePlus
Wraps DateTime().

Namespace

Drupal\Component\Datetime

Code

public function setDefaultDateTime() {
    $this->dateTimeObject
        ->setTime(12, 0, 0);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.