public function EntityLegalDocumentVersion::getFormattedDate in Entity Legal 3.0.x
Same name and namespace in other branches
- 8.2 src/Entity/EntityLegalDocumentVersion.php \Drupal\entity_legal\Entity\EntityLegalDocumentVersion::getFormattedDate()
- 4.0.x src/Entity/EntityLegalDocumentVersion.php \Drupal\entity_legal\Entity\EntityLegalDocumentVersion::getFormattedDate()
Get the date for a given entity property.
Parameters
string $type: The type of date to retrieve, updated or created.
Return value
string The formatted date.
Overrides EntityLegalDocumentVersionInterface::getFormattedDate
File
- src/
Entity/ EntityLegalDocumentVersion.php, line 149
Class
- EntityLegalDocumentVersion
- Defines the entity legal document version entity.
Namespace
Drupal\entity_legal\EntityCode
public function getFormattedDate($type = 'changed') {
switch ($type) {
case 'changed':
return \Drupal::service('date.formatter')
->format($this
->getChangedTime());
case 'created':
return \Drupal::service('date.formatter')
->format($this
->getCreatedTime());
}
}