I would like to pass a date in the format 2013-04-23 00:00:00
as a #default_value
into a form builder function:
$form['date'] = array(
'#title' => t('Date'),
'#type' => 'date',
'#default_value' => $my-array['date'],
);
...but the form renders dates in a three column drop-down widget (which I want to keep). How do I reformat my date and/or form builder function so that my three drop-downs display 23 Apr 2013? At present, they display 02 Feb 1900.
Thanks
Solution
See @tostinni's answer for half of the soluion. This is the second half:
$timestamp = strtotime($my-array['date']);
$day = date('d', $timestamp);
$month = date('n', $timestamp);
$year = date('Y', $timestamp);