Answers.Body: <p>I have a bunch of views set up that report on civi activities. I recall having some issues with the created date and ended up swapping to the scheduled activity date. Which I know sounds counter-intuitive but it was more accurate for me (we do a lot of creating scheduled activities and then completing them later). It also allowed me to use just one date field even when showing both complete and scheduled activities!</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-12-30T19:10:30.030Z
Answers.LastActivityDate: 2021-12-30T19:10:30.030Z
Answers.UserDisplayName: RayWright
Body: <p>I just created a Drupal 7 Views report to show the date and time when the user created a case activity. The date is correct. However, I entered this activity at 11:09 am this morning, but Views show the time as 7:08pm. I produced the same report in SearchKit and the time there is correct. Is the problem related to Views? I double checked that the date timezone is correct in &quot;Default site/user timezone&quot;.</p>
  <p>Drupal, PHP, and MySQL timezones match. The activity_created_date table also lists the correct info:  2021-12-24 11:09. Not sure why Views is producing the time as 7:08 pm instead of 11:09 am.</p>
  <p>My temporary fix right now is use Global:PHP and subtract 8 hours manually. Although this works, I can't expose this date field for filtering results.</p>
  <pre><code>&lt;?php
  $hoursToSubtract = 8;
  $timeToSubtract = ($hoursToSubtract * 60 * 60);
  $timeInPast = ($row-&gt;created_date - $timeToSubtract);
  echo date(&quot;m/d/Y g:ia&quot;, $timeInPast);
  ?&gt;
  </code></pre>
  
Tags: <civicase><activities><drupal-views>
Title: Activity Time Incorrect in Drupal Views
ThreadText: # Activity Time Incorrect in Drupal Views
  
  (Asked by: username_0 on 2021-12-24)
  
  I just created a Drupal 7 Views report to show the date and time when the user created a case activity. The date is correct. However, I entered this activity at 11:09 am this morning, but Views show the time as 7:08pm. I produced the same report in SearchKit and the time there is correct. Is the problem related to Views? I double checked that the date timezone is correct in "Default site/user timezone".
  Drupal, PHP, and MySQL timezones match. The activity_created_date table also lists the correct info:  2021-12-24 11:09. Not sure why Views is producing the time as 7:08 pm instead of 11:09 am.
  My temporary fix right now is use Global:PHP and subtract 8 hours manually. Although this works, I can't expose this date field for filtering results.
  created_date - $timeToSubtract);
  echo date("m/d/Y g:ia", $timeInPast);
  ?>
  
  **Tags:** civicase, activities, drupal-views
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2021-12-30. Score: 0
  
  I have a bunch of views set up that report on civi activities. I recall having some issues with the created date and ended up swapping to the scheduled activity date. Which I know sounds counter-intuitive but it was more accurate for me (we do a lot of creating scheduled activities and then completing them later). It also allowed me to use just one date field even when showing both complete and scheduled activities!
  
  
  ---
  
  