Answers.Body: <p>Your <code>entry.expiration</code> is actually an object of type DateTime thus you'll have the full power of PHPs <a href="http://php.net/manual/en/datetime.diff.php" rel="nofollow noreferrer">DateDiff</a> functionality </p>
  
  <pre><code>$interval = $datetime1-&gt;diff($datetime2);
  </code></pre>
  
  <p>In Twig this is something like </p>
  
  <pre><code>{% set difference = now.diff(entry.expiration) %} 
  {{ difference.format('%R%a days') }} 
  </code></pre>
  
  <p><code>now</code> should be the current date </p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-06-02T12:38:44.817Z
Answers.LastActivityDate: 2018-06-02T14:16:39.820Z
Answers.LastEditDate: 2018-06-02T14:16:39.820Z
Answers.UserDisplayName: Robin Schambach
Body: <p>I'm trying to display how long til a certain post expires depending on a date/time field. </p>
  
  <p><strong>Example</strong></p>
  
  <blockquote>
    <p>Expires in 13 days.</p>
  </blockquote>
  
  <p>My field is currently displayed by doing <code>{{ entry.expiration }}</code></p>
  
  <p>I just don't know how I would just display the days remaining until this date.</p>
  
  <p>Thanks</p>
  
Tags: <templating><entries>
Title: Displaying how long til post expires
ThreadText: # Displaying how long til post expires
  
  (Asked by: username_0 on 2018-06-02)
  
  I'm trying to display how long til a certain post expires depending on a date/time field.
  
  **Example**
  
  > Expires in 13 days.
  
  My field is currently displayed by doing `{{ entry.expiration }}`
  
  I just don't know how I would just display the days remaining until this date.
  
  Thanks
  
  **Tags:** templating, entries
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2018-06-02. Score: 3 | Accepted answer
  
  Your `entry.expiration` is actually an object of type DateTime thus you'll have the full power of PHPs [DateDiff](http://php.net/manual/en/datetime.diff.php) functionality
  
  ```
  $interval = $datetime1->diff($datetime2);
  
  ```
  
  In Twig this is something like
  
  ```
  {% set difference = now.diff(entry.expiration) %} 
  {{ difference.format('%R%a days') }} 
  
  ```
  
  `now` should be the current date
  
  
  ---
  
  