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.
closed as too broad by kiamlaluno♦ Jan 20 '17 at 17:41
Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.
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.