I am building a form the standard symfony2 way like so
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder->add('publishedAt', 'datetime');
}
this is working great, but it provides a dropdown for the month like so
<select>
<option value="1">01</option>
<option value="2">02</option>
<option value="3">03</option>
</select>
What I would really like is a dropdown that uses strings as the option text more like this
<select>
<option value="1">Jan</option>
<option value="2">Feb</option>
<option value="3">Mar</option>
</select>
What is the correct way to achieve this?
Use:
you can play with this date_format to do things like show the year at the end (dd-MMM-yyyy) or show only two digits for the year. (dd-MM-yy). Notice that this date format only accepts the y,M and d formats (so, no day of the week, for example) and that there is no corresponding ‘time_format’ for the time. More info about the format specifiers here