How to store date_popup fileld in mysql For some reason I cannot save the value of my date_popup field (comment_date) to mysql database. 
I need to use default value from existing field (field_due_date6) and store the new value to this field.
So I do the following:

function custom_form_alter(&amp;$form, $form_state, $form_id) {
  $form['comment_date'] = array(
      '#date_format' =&gt; 'Y-m-d',
      '#date_year_range' =&gt; '0:+1',
      '#type' =&gt; 'date_popup',
      '#weight'=&gt;1,
      '#datepicker_options' =&gt; array('minDate' =&gt; 0),
      '#default_value' =&gt; $form['#node']-&gt;field_due_date6['und'][0]['value']
    );
}


Then I'm trying to submit it to database:

function custom_support_comment_submit($form, &amp;$form_state) {
  $node = node_load($form_state['values']['nid']);
  $node_wrapper = entity_metadata_wrapper('node', $node);

  if($form_state['values']['comment_date']) {
    $node_wrapper-&gt;field_due_date6-&gt;set($form_state['values']['comment_date']);
  }
  $node_wrapper-&gt;save();  
}


But when I click Submit button I got the error - 

EntityMetadataWrapperException: Invalid data value given. Be sure it matches the required data type and format. в функции EntityMetadataWrapper-&gt;set() (строка 122 в файле Z:\home\dd1\www\sites\all\modules\entity\includes\entity.wrapper.inc).


Could you please specify what I'm doing wrong?
Node Field must be expecting date field value in unixtimestamp format while the custom form will return the value in the format mention as '#date_format' => 'Y-m-d'. View of your form submit values will look like.



You should run the submit date value through strtotime() to get the unxtimestamp value for it before assigning it to node field.

$node_wrapper-&gt;field_due_date6-&gt;set(strtotime($form_state['values']['comment_date']));