In the controller:

public function indexAction(Request $request) { $source = ... $grid = $this->get('grid'); $grid->setSource($source); return $grid->getGridResponse('index.html.twig'); } 

In index.html.twig:

 {% extends 'base.html.twig' %} {% block center %} <div class="row"> <div class="col-md-12"> {{ grid(grid) }} </div> </div> {% endblock center %} 

In Entity:

 /** * @var \DateTime * @Map\Field(type="date", api="date_send") */ protected $sendAt; 

There is a sendAt column in the Entity, it is DateTime and it is output in the grid in a standard format. Question: How to change the date format in the Grid (sendAt columns) in the controller without changing the Entity structure?

    1 answer 1

    Need to use:

     $grid->getColumns()->getColumnById('sendAt')->setFormat('dmY H:i');