Symfony 2 Datetime field in forms

I build my form as follows:

$builder->add('taskDate', 'datetime', array( 'required'=>false, 'label'=>'Termin', 'input'=>'datetime', 'widget'=>'single_text', 'attr'=>array('style'=>'max-width: 150px;') )) 

And I got it

  2014-02-01T20: 00: 00 + 01: 00 

How can I get the β€œnormal” Datetime format, like what I have in my SQL database?

It is saved in my database as follows: 2014-02-01 20:00:00 .

So why do I have a T letter and +01:00 at the end?

0
source share
1 answer

Check the date_format option for the Datetime field type :

 date_format: type: integer or string default: IntlDateFormatter::MEDIUM Defines the format option that will be passed down to the date field. 

See date format for details.

+2
source

Source: https://habr.com/ru/post/1201519/


All Articles