How do I set the default value of a datetime form element? I have a requirement of developing a custom contact form in drupal 8. I am able add all the fields but coming to date time field unable to set the default value to current date.

This is my date field code

$form['start_date'] = [
  '#type' =&gt; 'datetime',
  '#title' =&gt; t('Start Date'),
  '#description' =&gt; date($date_format, time()),
  '#default_value' =&gt; time(),
];
use Drupal\Core\Datetime\DrupalDateTime;

and in form 

$form['start_date'] = array(
  '#type' =&gt; 'datetime',
  '#title' =&gt; t('Start Date'),
  '#default_value' =&gt; DrupalDateTime::createFromTimestamp(time()),
);