title: How to get days difference in twig
body: <ul>
  <li><p>how to get days diffrence from current day.</p></li>
  <li><p>tweetedAt: "2015-02-22 09:56:42".</p></li>
  </ul>
  
  <p>twig </p>
  
  <pre><code>{% for key,value in data.about %}
  {% set tweets_date=(value.tweetedAt|date).date("now").format('%a') %}
  {% endfor %}
  </code></pre>
  
  <p>I have also tried</p>
  
  <pre><code>{% set dd='now'|date('d-m-Y') %}
  {% set tweets_date=(value.tweetedAt|date).dd.format('%a') %}
  </code></pre>
  
  <p>Finally I tried but its giving error:</p>
  
  <blockquote>
    <p>A hash key must be a quoted string, a number, a name, or an expression enclosed in parentheses (unexpected token "punctuation" of value "{"</p>
  </blockquote>
  
  <pre><code>{% set difference = {{ date("m/d/Y") }}.diff(date(value.tweetedAt)) %}
  {% set leftDays = difference.days %}
  </code></pre>
  
  <p>Error: </p>
  
  <pre><code>&lt;span class="small light_grey"&gt;{{tweets_date}}&lt;/span&gt;
  
  Impossible to invoke a method ("date") on a string variable ("June 6, 2015 01:06") in AcmeBundle
  </code></pre>
  
  <ul>
  <li>how to get diffrence from <code>tweet_date</code> in days ago form.</li>
  </ul>
  
  <p>Updated my project installing <code>twig/extensions</code> via composer</p>
  
  <pre><code>user@intermsh-OptiPlex-380:~$ composer require twig/extensions
  Warning: This development build of composer is over 30 days old. It is recommended to update it by running "/usr/local/bin/composer self-update" to get the latest version.
  Using version ~1.2 for twig/extensions
  ./composer.json has been updated
     Loading composer repositories with package information
     Updating dependencies (including require-dev)
     - Installing twig/twig (v1.18.2)
     Downloading: 100%         
  
     - Installing twig/extensions (v1.2.0)
     Downloading: 100%         
     Downloading: 100%         
  
  twig/extensions suggests installing symfony/translation (Allow the time_diff output to be translated)
  Writing lock file
  Generating autoload files
  </code></pre>