Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8545745
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T12:51:47+00:00 2026-06-11T12:51:47+00:00

I am building a form the standard symfony2 way like so public function buildForm(FormBuilderInterface

  • 0

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?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T12:51:48+00:00Added an answer on June 11, 2026 at 12:51 pm

    Use:

       $builder->add('publishedAt', 'datetime', array(
            'date_format' => 'yyyy-MMM-dd'
        ));
    

    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

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm building form using Sf2's form builder. public function buildForm(FormBuilder $builder, array $options) {
//--form timesheettype---it is not entity class class TimeSheetType extends AbstractType { public function buildForm(FormBuilder
Im building a form that will function like a keypad on a touch screen.
I'm building an app in JQM which receives user input using standard form elements.
I am building a form class in Symfony2. In my class, I have a
I am building on a standard form driven user login panel. Works well enough.
I'm building form with images like a label... I have: DIV.icon-phone { width: 22px
I'm building form validation controls for our C# ASP application. The bulk of the
Am building window form application for a clinic using VS2010. On the form in
I'm building a form for searching a database inside my application, and I only

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.