You are here

public static function WebformDateHelper::formatStorage in Webform 8.5

Same name and namespace in other branches
  1. 6.x src/Utility/WebformDateHelper.php \Drupal\webform\Utility\WebformDateHelper::formatStorage()

Format date/time object to be written to the database using 'Y-m-d\TH:i:s'.

Parameters

\Drupal\Core\Datetime\DrupalDateTime $date: A DrupalDateTime object.

Return value

string The date/time object format as 'Y-m-d\TH:i:s'.

3 calls to WebformDateHelper::formatStorage()
WebformEntityReferenceWidgetTrait::massageFormValues in src/Plugin/Field/FieldWidget/WebformEntityReferenceWidgetTrait.php
WebformEntitySettingsFormForm::save in src/EntitySettings/WebformEntitySettingsFormForm.php
Form submission handler for the 'save' action.
webform_demo_event_registration_install in modules/webform_demo/webform_demo_event_registration/webform_demo_event_registration.install
Implements hook_install().

File

src/Utility/WebformDateHelper.php, line 69

Class

WebformDateHelper
Helper class webform date helper methods.

Namespace

Drupal\webform\Utility

Code

public static function formatStorage(DrupalDateTime $date) {
  return $date
    ->format(DateTimeItemInterface::DATETIME_STORAGE_FORMAT);
}