You are here

function datetime_date_default_time in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/datetime/datetime.module \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()
DateTimeCustomFormatter::viewElements in core/modules/datetime/src/Plugin/Field/FieldFormatter/DateTimeCustomFormatter.php
Builds a renderable array for a field value.
DateTimeDefaultFormatter::viewElements in core/modules/datetime/src/Plugin/Field/FieldFormatter/DateTimeDefaultFormatter.php
Builds a renderable array for a field value.
DateTimeFieldTest::testDateField in core/modules/datetime/src/Tests/DateTimeFieldTest.php
Tests date field functionality.
DateTimePlainFormatter::viewElements in core/modules/datetime/src/Plugin/Field/FieldFormatter/DateTimePlainFormatter.php
Builds a renderable array for a field value.
DateTimeTimeAgoFormatter::viewElements in core/modules/datetime/src/Plugin/Field/FieldFormatter/DateTimeTimeAgoFormatter.php
Builds a renderable array for a field value.

... See full list

File

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

Code

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