I'm trying to edit email template and format created date of a Magento 2.3 installation.
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? How to debug this?