You are here

public function DateTimePlus::setDefaultDateTime in Drupal 8

Same name and namespace in other branches
  1. 9 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 718

Class

DateTimePlus
Wraps DateTime().

Namespace

Drupal\Component\Datetime

Code

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