How can we remove the time in the order created date inside the transactional email?

We now load it like this; {{var created_at_formatted}} and displayed as: 9 apr. 2020 11:17:59

We want to remove the time and change the format to 9 April 2020.

1 Answer 1


you can use {{trans '%created_at' created_at=$order.getCreatedAtFormatted(3)}}

All possible parameter of getCreatedAtFormatted() are :

/* date/time format types */
const NONE = -1;
const FULL = 0;
const LONG = 1;
const MEDIUM = 2;
const SHORT = 3;

If it doesn't work then override method getCreatedAtFormatted($format) from vendor\magento\modules-sales\model\Order.php ; in your custom module and set $format to 0 when calling it in your mail template.

public function getCreatedAtFormatted($format)
return $this->timezone->formatDateTime(
    new \DateTime($this->getCreatedAt()),
    $this->timezone->getConfigTimezone('store', $this->getStore()),
    'd M Y' // <-------------------- add this   
  • Thanks a lot! It seems that {{trans '%created_at' created_at=$order.getCreatedAtFormatted(3)}} got the output; 09-04-2020 11:17 Still the time displayed. Any other solutions instead of changing the Order.php file?
    – JGeer
    Apr 16, 2020 at 13:05
  • 1
    No i think the only way is to change this method or the better soluction is to create other method and call it in mail template, like in this post magento.stackexchange.com/a/241626/88489 Apr 16, 2020 at 14:32
  • Thanks! That works perfect.
    – JGeer
    Apr 16, 2020 at 19:40

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.