php - Symfony2 datetime field form -


i have symfony2 application receive json data in form. 1 of field date time. if renderize field form in way:

->add('startdate', 'date', array(         'widget' => 'single_text',         'format' => 'yyyy-mm-dd hh:mm:ss')) 

this accept like:

"startdate": "2015-05-03 12:30:00" 

but need introduce datetime in way:

"startdate": "2015-05-12t15:43:00+0200" 

how can set format in field?

on http://php.net/manual/en/function.date.php

"c" => iso 8601 date (added in php 5) => 2004-02-12t15:19:21+00:00

try this:

->add('startdate', 'date', array(     'widget' => 'single_text',     'format' => 'c')) 

i hope helps.


Comments

Popular posts from this blog

android - MPAndroidChart - How to add Annotations or images to the chart -

javascript - Add class to another page attribute using URL id - Jquery -

firefox - Where is 'webgl.osmesalib' parameter? -