class Date

The date data type.

The plain value of a date is an instance of the DrupalDateTime class. For setting the value any value supported by the __construct() of the DrupalDateTime class will work, including a DateTime object, a timestamp, a string date, or an array of date parts.

Hierarchy

Expanded class hierarchy of Date

22 string references to 'Date'
Date::getSortName in drupal/core/modules/views/lib/Drupal/views/Plugin/views/argument/Date.php
Return a description of how the argument would normally be sorted.
datetime_datetime_form_process in drupal/core/modules/datetime/datetime.module
Expands a #datetime element type into date and/or time elements.
datetime_field_info in drupal/core/modules/datetime/datetime.module
Implements hook_field_info().
DbLogController::overview in drupal/core/modules/dblog/lib/Drupal/dblog/Controller/DbLogController.php
Displays a listing of database log messages.
dblog_event in drupal/core/modules/dblog/dblog.admin.inc
Page callback: Displays details about a specific database log message.

... See full list

File

drupal/core/lib/Drupal/Core/TypedData/Type/Date.php, line 22
Contains \Drupal\Core\TypedData\Type\Date.

Namespace

Drupal\Core\TypedData\Type
View source
class Date extends TypedData {

  /**
   * The data value.
   *
   * @var DateTime
   */
  protected $value;

  /**
   * Overrides TypedData::setValue().
   */
  public function setValue($value, $notify = TRUE) {

    // Notify the parent of any changes to be made.
    if ($notify && isset($this->parent)) {
      $this->parent
        ->onChange($this->name);
    }

    // Don't try to create a date from an empty value.
    // It would default to the current time.
    if (!isset($value)) {
      $this->value = $value;
    }
    else {
      $this->value = $value instanceof DrupalDateTime ? $value : new DrupalDateTime($value);
    }
  }

}

Members

Namesort descending Modifiers Type Description Overrides
Date::$value protected property The data value.
Date::setValue public function Overrides TypedData::setValue(). Overrides TypedData::setValue
TypedData::$definition protected property The data definition.
TypedData::$name protected property The property name.
TypedData::$parent protected property The parent typed data object.
TypedData::getConstraints public function Implements \Drupal\Core\TypedData\TypedDataInterface::getConstraints(). Overrides TypedDataInterface::getConstraints 2
TypedData::getDefinition public function Implements \Drupal\Core\TypedData\TypedDataInterface::getDefinition(). Overrides TypedDataInterface::getDefinition
TypedData::getName public function Implements \Drupal\Core\TypedData\TypedDataInterface::getName(). Overrides TypedDataInterface::getName
TypedData::getParent public function Implements \Drupal\Core\TypedData\TypedDataInterface::getParent(). Overrides TypedDataInterface::getParent
TypedData::getPropertyPath public function Implements \Drupal\Core\TypedData\TypedDataInterface::getPropertyPath(). Overrides TypedDataInterface::getPropertyPath
TypedData::getRoot public function Implements \Drupal\Core\TypedData\TypedDataInterface::getRoot(). Overrides TypedDataInterface::getRoot
TypedData::getString public function Implements \Drupal\Core\TypedData\TypedDataInterface::getString(). Overrides TypedDataInterface::getString 7
TypedData::getType public function Implements \Drupal\Core\TypedData\TypedDataInterface::getType(). Overrides TypedDataInterface::getType
TypedData::getValue public function Implements \Drupal\Core\TypedData\TypedDataInterface::getValue(). Overrides TypedDataInterface::getValue 8
TypedData::setContext public function Implements \Drupal\Core\TypedData\TypedDataInterface::setContext(). Overrides TypedDataInterface::setContext 1
TypedData::validate public function Implements \Drupal\Core\TypedData\TypedDataInterface::validate(). Overrides TypedDataInterface::validate 3
TypedData::__construct public function Constructs a TypedData object given its definition and context. 5