We sacrifice by not doing any other technology, so that you get the best of Magento.

We sacrifice by not doing any other technology, so that you get the best of Magento.

    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.

    public function scopeDate($scope = null, $date = null, $includeTime = false)
    {
        ...
        ...
    }

    Step 4 : Place this below mention function after above commented function.

    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

    - 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.

    field_5bfb909c5ccae

      Get a Free Quote