How to use birthday field in symfony2 forms


<a href="http://symfony.com/doc/current/reference/forms/types/birthday.html" rel="nofollow">Symfony Docs</a> say that we can use birthday date in forms. but they have not given any example how to use that

Can anyone please tell me where do I need to write birthday in doctrine entity?


The Birthday is the form_widget.

ex. in controller:

$form = $this->createFormBuilder($task) ->add('task', 'text') ->add('yearOfBirth', 'birthday') ->getForm();

This widget can be mapped to DateTime field

/** * @var date $yearOfBirth * * @ORM\Column(name="year_of_birth", type="datetime") * @Assert\DateTime() */ private $yearOfBirth;

Here you got reference to docs about this field: <a href="http://symfony.com/doc/current/reference/forms/types/birthday.html" rel="nofollow">http://symfony.com/doc/current/reference/forms/types/birthday.html</a>

Regards, Max


$builder->add('dateOfBirth', 'birthday');

You have plenties of example on the internet:

<ul><li><a href="https://stackoverflow.com/questions/8269519/how-to-display-months-in-full-text-for-date-fields-in-symfony2" rel="nofollow">How to display months in full text for Date fields in Symfony2?</a></li> <li><a href="http://j-place.developpez.com/tutoriels/php/creer-premiere-application-web-avec-symfony2/#LX-A" rel="nofollow">http://j-place.developpez.com/tutoriels/php/creer-premiere-application-web-avec-symfony2/#LX-A</a></li> </ul>


  • Im stuck on java programing [closed]
  • Populate Multiple Forms Symfony2
  • Laravel 5.1 pagination count
  • Symfony ChoiceType $choices - labels and values swapped
  • Symfony 2 form in embedded controller and AJAX
  • How to use java.time.LocalDate on a Play Framework JSON Rest?
  • Converting Twitter DateTime to Localtime with adding UTC offset [duplicate]
  • How to parse utc date
  • What's the alternative to IValueFormatter in AutoMapper?
  • Running sp_executesql query expects parameter @statement
  • How to get ID of changed file on Google Drive
  • How to set infinite shared access signature policy in azure?
  • Entire JSON into One SQLite Field with Python
  • stop execution in Custom validator if it false
  • How to enable mapping the private property of the entity
  • What is corresponding c++ data type to SQL numeric(18,0) data type?
  • Two Tables Serving as one Model in Rails
  • Do query loads all the data in memory
  • Add dynamic data to line chart from mysql database with highcharts
  • JqueryMobile Popup menu is not working
  • Extract zip entries to another Zip file
  • Android - Material Design - NavigationView - How to put vertical scroll?
  • ActiveRecord query for a count of new users by day
  • Handling un-mapped Rest path
  • Illegal mix of collations for operation for date/time comparison
  • MySQL WHERE-condition in procedure ignored
  • Web-crawler for facebook in python
  • Cannot Parse HTML Data Using Android / JSOUP
  • trying to dynamically update Highchart column chart but series undefined
  • Hits per day in Google Big Query
  • Angular 2 constructor injection vs direct access
  • How do I configure my settings file to work with unit tests?
  • Java static initializers and reflection
  • Android Google Maps API OnLocationChanged only called once
  • IndexOutOfRangeException on multidimensional array despite using GetLength check
  • Checking variable from a different class in C#
  • Binding checkboxes to object values in AngularJs
  • UserPrincipal.Current returns apppool on IIS
  • java string with new operator and a literal
  • How can I use threading to 'tick' a timer to be accessed by other threads?