I am new to Drupal. I need to set a default value to a date field. Please anyone help me on this. Thanks.

1 Answer 1


Please see below code to set a default value for date field using hook_form_alter

$form["your_date_field"]["und"][0]['#default_value']['value'] = '2016-11-16 00:00:00';

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.