All I want to do is get the value out of a date field in Drupal 8, but they have done an expert job of making this impossible. The error I get is that 'dateTimeObject' is protected so I have no access to it.
Try this out -
$schedule_start = $form_state->getValue('field_start')->format("Y-m-d H:i:s"); $schedule_end = $form_state->getValue('field_end')->format("Y-m-d H:i:s");
Provide your own desirable format.