Drupal - Set value for date field in hook_form_alter
The date field's a funny one, normally the field column name is the last in the array (like the first example you tried), and the default value is set on that.
For a date field though, the default value is an array, and it's one level further up, e.g.:
$form["field_price_date"]["und"][0]['#default_value']['value'] = $curDate;
For future reference, install the Devel module
and use the dpm()
function to print a breakdown of the form array to the screen (dpm($form);
). It makes debugging this kind of thing so much easier.