When we create a date field in node form, we can set START and END years to be shown in that date field. If we are creating a date field programatcaly, how do we do that?
I have a date field, my_date
, I want to to show only next 5 years from now on. Any help?
$form['my_date'] = array( '#type' => 'date', '#date_format' => 'd-m-y', '#default_value' => format_date($primary_start1, 'custom', $format), '#date_type' => DATE_DATETIME, '#date_timezone' => date_default_timezone(), '#date_format' => 'm/d/Y', '#size' => 20, '#access' => TRUE, );
I tried to see structure bu creating a date field and printing the form, but found nothing.