When PDF Incvoice show wrong date in Magento 2.3.5 then follow below steps.
Step 1 : Go to this path /vendor/magento/framework/Stdlib/DateTime/Timezone.php
Step 2 : Go to line no. 196 (approx).
Step 3 : Comment this below function.
1 2 3 4 5 |
public function scopeDate($scope = null, $date = null, $includeTime = false) { ... ... } |
Step 4 : Place this below mention function after above commented function.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
public function scopeDate($scope = null, $date = null, $includeTime = false) { $timezone = new \DateTimeZone( $this->_scopeConfig->getValue($this->getDefaultTimezonePath(), $this->_scopeType, $scope) ); switch (true) { case (empty($date)): $date = new \DateTime('now', $timezone); break; case ($date instanceof \DateTime): case ($date instanceof \DateTimeImmutable): $date = $date->setTimezone($timezone); break; default: $date = new \DateTime(is_numeric($date) ? '@' . $date : $date); $date->setTimezone($timezone); break; } if (!$includeTime) { $date->setTime(0, 0, 0); } return $date; } |
Step 5 : After that run below mentioned commands
1 2 |
- php bin/magento setup:upgrade - php bin/magento cache:clean |
That’s it.
After performing above steps, you can check the PDF Invoice. You will find the appropriate date in your PDF Invoices.
Please follow the below methods to get the attribute options...
Update product attribute value programmatically in Magento 2 . [crayon-6287758cc6b4f525905719/]...
If you want restrict customer to checkout based on your...
Sometime we need to set html data without load or...
If you want get query string params in controller file,...