private function SmartDateWidgetBase::smartGetTimestamp in Smart Date 3.x
Same name and namespace in other branches
- 8.2 src/Plugin/Field/FieldWidget/SmartDateWidgetBase.php \Drupal\smart_date\Plugin\Field\FieldWidget\SmartDateWidgetBase::smartGetTimestamp()
- 3.0.x src/Plugin/Field/FieldWidget/SmartDateWidgetBase.php \Drupal\smart_date\Plugin\Field\FieldWidget\SmartDateWidgetBase::smartGetTimestamp()
- 3.1.x src/Plugin/Field/FieldWidget/SmartDateWidgetBase.php \Drupal\smart_date\Plugin\Field\FieldWidget\SmartDateWidgetBase::smartGetTimestamp()
- 3.2.x src/Plugin/Field/FieldWidget/SmartDateWidgetBase.php \Drupal\smart_date\Plugin\Field\FieldWidget\SmartDateWidgetBase::smartGetTimestamp()
- 3.3.x src/Plugin/Field/FieldWidget/SmartDateWidgetBase.php \Drupal\smart_date\Plugin\Field\FieldWidget\SmartDateWidgetBase::smartGetTimestamp()
- 3.4.x src/Plugin/Field/FieldWidget/SmartDateWidgetBase.php \Drupal\smart_date\Plugin\Field\FieldWidget\SmartDateWidgetBase::smartGetTimestamp()
Conditionally convert a DrupalDateTime object to a timestamp.
Parameters
\Drupal\Core\Datetime\DrupalDateTime $time: The time to be converted.
DateTimezone|null $timezone: An optional timezone to use for conversion.
1 call to SmartDateWidgetBase::smartGetTimestamp()
- SmartDateWidgetBase::massageFormValues in src/
Plugin/ Field/ FieldWidget/ SmartDateWidgetBase.php - Massages the form values into the format expected for field values.
File
- src/
Plugin/ Field/ FieldWidget/ SmartDateWidgetBase.php, line 288
Class
- SmartDateWidgetBase
- Base class for the 'smartdate_*' widgets.
Namespace
Drupal\smart_date\Plugin\Field\FieldWidgetCode
private function smartGetTimestamp(DrupalDateTime $time, $timezone = NULL) {
// Map the date to be relative to a provided timezone, if supplied.
if ($timezone) {
$time = $this
->remapDatetime($time, $timezone);
}
return $time
->getTimestamp();
}