I'm new to drupal, can anyone tell me how can I create a date field with only month and year in my custom form? I have found a module for it but I want that field in my custom module form.
I have tried many things with form and I'm expecting something like this
$form['filters']['report_month'] = array(
'#type' => 'date',
'#title' => t('Report Month'),
'#date_date_format' => 'm/Y',
'#date_date_element' => 'month',
'#default_value' => date("m-Y"),
);
my job is done with this but if anyone has a better option please reply.