title: Format a date given from a json
body: <p>I search a way to format a date given from a json response. Currently I can pass the date via json response into both format :</p>
  
  <p>the string format:</p>
  
  <pre><code>{"date":"2016-11-25T11:24:54+0100"}
  </code></pre>
  
  <p>or the object format:</p>
  
  <pre><code>"date":{"timezone":{"name":"Europe\/Paris","location":{"country_code":"FR","latitude":48.86666,"longitude":2.33333,"comments":""}},"offset":3600,"timestamp":1480069808}}
  </code></pre>
  
  <p>I have to format one of this two json formats into that format:
  <code>dd/mm/aaaa</code>, example: 25/11/2016</p>
  
  <p>This operation must be done in my view, with jQuery/js, or in the controller before send the json reponse:</p>
  
  <pre><code>/*            $normalizer = new GetSetMethodNormalizer();      here the code for fomat the date into string
              $callback = function ($dateTime) {
                  return $dateTime instanceof \DateTime
                      ? $dateTime-&gt;format(\DateTime::ISO8601)
                      : '';
              };
              $normalizer-&gt;setCallbacks(array('date' =&gt; $callback));*/
  
              $normalizer-&gt;setIgnoredAttributes(array('article'));
              $serializer = new Serializer(array($normalizer), array($encoder));
              $dataJSON = $serializer-&gt;serialize($data, 'json');
  
              $response = new Response();
              $response-&gt;setContent($dataJSON);
              $response-&gt;headers-&gt;set('Content-Type', 'application/json');
  
              return $response;
  </code></pre>