class Timestamp
Same name in other branches
- 9 core/lib/Drupal/Core/TypedData/Plugin/DataType/Timestamp.php \Drupal\Core\TypedData\Plugin\DataType\Timestamp
- 8.9.x core/lib/Drupal/Core/TypedData/Plugin/DataType/Timestamp.php \Drupal\Core\TypedData\Plugin\DataType\Timestamp
- 11.x core/lib/Drupal/Core/TypedData/Plugin/DataType/Timestamp.php \Drupal\Core\TypedData\Plugin\DataType\Timestamp
The timestamp data type.
Hierarchy
- class \Drupal\Core\TypedData\TypedData implements \Drupal\Core\TypedData\TypedDataInterface, \Drupal\Component\Plugin\PluginInspectionInterface uses \Drupal\Core\DependencyInjection\DependencySerializationTrait, \Drupal\Core\StringTranslation\StringTranslationTrait, \Drupal\Core\TypedData\TypedDataTrait
- class \Drupal\Core\TypedData\PrimitiveBase extends \Drupal\Core\TypedData\TypedData implements \Drupal\Core\TypedData\PrimitiveInterface
- class \Drupal\Core\TypedData\Plugin\DataType\IntegerData extends \Drupal\Core\TypedData\PrimitiveBase implements \Drupal\Core\TypedData\Type\IntegerInterface
- class \Drupal\Core\TypedData\Plugin\DataType\Timestamp extends \Drupal\Core\TypedData\Plugin\DataType\IntegerData implements \Drupal\Core\TypedData\Type\DateTimeInterface
- class \Drupal\Core\TypedData\Plugin\DataType\IntegerData extends \Drupal\Core\TypedData\PrimitiveBase implements \Drupal\Core\TypedData\Type\IntegerInterface
- class \Drupal\Core\TypedData\PrimitiveBase extends \Drupal\Core\TypedData\TypedData implements \Drupal\Core\TypedData\PrimitiveInterface
Expanded class hierarchy of Timestamp
4 files declare their use of Timestamp
- TimestampItemNormalizer.php in core/
modules/ serialization/ src/ Normalizer/ TimestampItemNormalizer.php - TimestampItemNormalizerTest.php in core/
modules/ serialization/ tests/ src/ Unit/ Normalizer/ TimestampItemNormalizerTest.php - TimestampNormalizer.php in core/
modules/ serialization/ src/ Normalizer/ TimestampNormalizer.php - TimestampNormalizerTest.php in core/
modules/ serialization/ tests/ src/ Unit/ Normalizer/ TimestampNormalizerTest.php
97 string references to 'Timestamp'
- Comment::query in core/
modules/ comment/ src/ Plugin/ migrate/ source/ d6/ Comment.php - CommentSourceWithHighWaterTest::providerSource in core/
modules/ comment/ tests/ src/ Kernel/ Plugin/ migrate/ source/ d6/ CommentSourceWithHighWaterTest.php - core.data_types.schema.yml in core/
config/ schema/ core.data_types.schema.yml - core/config/schema/core.data_types.schema.yml
- core.data_types.schema.yml in core/
config/ schema/ core.data_types.schema.yml - core/config/schema/core.data_types.schema.yml
- core.data_types.schema.yml in core/
config/ schema/ core.data_types.schema.yml - core/config/schema/core.data_types.schema.yml
File
-
core/
lib/ Drupal/ Core/ TypedData/ Plugin/ DataType/ Timestamp.php, line 13
Namespace
Drupal\Core\TypedData\Plugin\DataTypeView source
class Timestamp extends IntegerData implements DateTimeInterface {
/**
* The data value as a UNIX timestamp.
*
* @var int
*/
protected $value;
/**
* {@inheritdoc}
*/
public function getDateTime() {
if (isset($this->value)) {
return DrupalDateTime::createFromTimestamp($this->value);
}
}
/**
* {@inheritdoc}
*/
public function setDateTime(DrupalDateTime $dateTime, $notify = TRUE) {
$this->value = $dateTime->getTimestamp();
// Notify the parent of any changes.
if ($notify && isset($this->parent)) {
$this->parent
->onChange($this->name);
}
}
}
Members
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.