diff --git a/CRM/Core/Payment/PayPalIPN.php b/CRM/Core/Payment/PayPalIPN.php index e854095b902a..6af63aaeeec3 100644 --- a/CRM/Core/Payment/PayPalIPN.php +++ b/CRM/Core/Payment/PayPalIPN.php @@ -394,6 +394,12 @@ public function getInput(&$input, &$ids) { $paymentDate = $this->retrieve('payment_date', 'String', FALSE); if (!empty($paymentDate)) { $receiveDateTime = new DateTime($paymentDate); + /** + * The `payment_date` that Paypal sends back is in their timezone. Example return: 08:23:05 Jan 11, 2019 PST + * Subsequently, we need to account for that, otherwise the recieve time will be incorrect for the local system + */ + $systemTimeZone = new DateTimeZone(CRM_Core_Config::singleton()->userSystem->getTimeZoneString()); + $receiveDateTime->setTimezone($systemTimeZone); $input['receive_date'] = $receiveDateTime->format('YmdHis'); } }