Answers.Body: <p>Got it!</p>
  
  <p><strong>In Drupal added the Unix Timestamp format:</strong>
  Administration/Regional and Language/Formats/Add Format.
  For the string I put in <code>U</code>.
  Added the Date Type Unix Timestamp</p>
  
  <p><strong>In the View:</strong>
  Added the Start and End Date fields.
  Under Date Format selected the Unix Timestamp type I just created.
  Added a Math Expression field with the expression <code>(([end_date]-[start_date])/86400)</code> since there are 86400 seconds in a day.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-09-04T18:18:02.217Z
Answers.LastActivityDate: 2015-09-04T18:25:47.937Z
Answers.LastEditDate: 2015-09-04T18:25:47.937Z
Answers.UserDisplayName: pmoz
Body: <p>Trying to create a Drupal View that shows total number of days in a case.</p>
  
  <p>There are two methods I'm considering:</p>
  
  <p>First, I imagine if I could turn the case start date and end date into "Days Ago" within the view I could perform a math calculation of [end_date]-[start_date] to get the number.</p>
  
  <p>The other method I thought may work would be to create an aggregate table through views that displayed a daily case load.  For example, on 1.1.15 list these 5 people that have ongoing cases.  On 1.2.15 list these 5 people that have an open case.  From there, I could group by contact name and count.</p>
  
  <p>Anyone have any ideas or done something similar?</p>
  
Tags: <civicase><drupal-views><dates>
Title: How to show Days in Case in Drupal Views?
ThreadText: # How to show Days in Case in Drupal Views?
  
  (Asked by: username_0 on 2015-09-04)
  
  Trying to create a Drupal View that shows total number of days in a case.
  
  There are two methods I'm considering:
  
  First, I imagine if I could turn the case start date and end date into "Days Ago" within the view I could perform a math calculation of [end\_date]-[start\_date] to get the number.
  
  The other method I thought may work would be to create an aggregate table through views that displayed a daily case load. For example, on 1.1.15 list these 5 people that have ongoing cases. On 1.2.15 list these 5 people that have an open case. From there, I could group by contact name and count.
  
  Anyone have any ideas or done something similar?
  
  **Tags:** civicase, drupal-views, dates
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_0 on 2015-09-04. Score: 3 | Accepted answer
  
  Got it!
  
  **In Drupal added the Unix Timestamp format:**
  Administration/Regional and Language/Formats/Add Format.
  For the string I put in `U`.
  Added the Date Type Unix Timestamp
  
  **In the View:**
  Added the Start and End Date fields.
  Under Date Format selected the Unix Timestamp type I just created.
  Added a Math Expression field with the expression `(([end_date]-[start_date])/86400)` since there are 86400 seconds in a day.
  
  
  ---
  
  