0

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.

<?php
$hoursToSubtract = 8;
$timeToSubtract = ($hoursToSubtract * 60 * 60);
$timeInPast = ($row->created_date - $timeToSubtract);
echo date("m/d/Y g:ia", $timeInPast);
?>

1 Answer 1

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!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.