function datetime_date_default_time

Sets a consistent time on a date without time.

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.

Parameters

$date:

7 calls to datetime_date_default_time()
DateTimeDatelistWidget::formElement in drupal/core/modules/datetime/lib/Drupal/datetime/Plugin/field/widget/DatetimeDatelistWidget.php
Implements \Drupal\field\Plugin\Type\Widget\WidgetInterface::formElement().
DateTimeDefaultFormatter::viewElements in drupal/core/modules/datetime/lib/Drupal/datetime/Plugin/field/formatter/DatetimeDefaultFormatter.php
Builds a renderable array for a field value.
DateTimeDefaultWidget::formElement in drupal/core/modules/datetime/lib/Drupal/datetime/Plugin/field/widget/DatetimeDefaultWidget.php
Implements \Drupal\field\Plugin\Type\Widget\WidgetInterface::formElement().
DatetimeFieldTest::testDateField in drupal/core/modules/datetime/lib/Drupal/datetime/Tests/DatetimeFieldTest.php
Tests date field functionality.
DateTimePlainFormatter::viewElements in drupal/core/modules/datetime/lib/Drupal/datetime/Plugin/field/formatter/DatetimePlainFormatter.php
Implements Drupal\field\Plugin\Type\Formatter\FormatterInterface::viewElements().

... See full list

File

drupal/core/modules/datetime/datetime.module, line 304
Field hooks to implement a simple datetime field.

Code

function datetime_date_default_time($date) {
  $date
    ->setTime(12, 0, 0);
}