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()),
            $this->timezone->getConfigTimezone('store', $this->getStore())

This function must read Locale (it_IT in my case)


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?

1 Answer 1


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
    Commented Jun 20, 2019 at 9:22

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.