Default value to 'datetime' field in form loaded from the database
The response is in this thread : on stackoverflow

$form['valid_dt'] = array(
    '#type' =&gt; 'datetime',
    '#default_value' =&gt; DrupalDateTime::createFromTimestamp($data-&gt;valid_dt),
    '#title' =&gt; $this-&gt;t('Valid'),      
);