I want to display the datetime field on my Drupal 8 form with some date loaded from the database, but the front end always shows empty fields as if no data has been provided. I tried several combinations to default_value field, but none of them are showing any thing.
The code I am using is the following.
$form['dateopening'] = array(
'#type' => 'datetime',
'#title' => t('Opening Date'),
'#default_value'=> date('Y-m-d H:i:s', strtotime($dateFromDB)),
);
Why doesn't it set the default value as expected?