Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. DateTimePlus.php

function 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);
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal