0

I'm trying to edit email template and format created date. The date in the email is written using this variable

 {{var order.created_at}}

And I think that It is created using the following function of vendor/magento/module-sales/Model/Order.php

 /**
     * Get formatted order created date in store timezone
     *
     * @param int $format date format type (\IntlDateFormatter::SHORT|\IntlDateFormatter::MEDIUM
     * |\IntlDateFormatter::LONG|\IntlDateFormatter::FULL)
     * @return string
     */
    public function getCreatedAtFormatted($format)
    {
        return $this->timezone->formatDateTime(
            new \DateTime($this->getCreatedAt()),
            $format,
            $format,
            $this->localeResolver->getDefaultLocale(),
            $this->timezone->getConfigTimezone('store', $this->getStore())
        );
    }

This function must read Locale (it_IT in my case)

        $this->localeResolver->getDefaultLocale(),

but the date is always formatted in yyyy-mm-dd hh:mm

Is it correct?

I'd like to use italian version dd-mm-yyyy hh:mm, it is possible?

0

try this code

$originalDate = "2019-06-20";
echo "new date : ".$newDate = date("d-m-Y h:m", strtotime($originalDate));
  • I think I can't add php in transactional email! Is not so? – domfitty Jun 20 at 9:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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