Magento How to format a date in an email template

I need to format the date in an email template. The date will be included in regular email .htmlas follows:

Dispatch Date: {{var order.getShippingDate()}}

Can I format this date? I tried using the standard PHP function dateto format it to no avail.

+2
source share
3 answers

strtotime any help? It can parse the data back to the unix timestamp, and that means date () is awaiting input.

edit after comment:

app/code/core/Mage/Sales/Model/Order.php app/code/local ( , magento ). , getCreatedAtFormated - , , .

+3

{{block type='core/template' area='frontend' template='email/order/shipment/date.phtml' shipment=$shipment order=$order}}

.

,

 /**
    * Setup callbacks for filters
    *
    */
    public function __construct()
    {
        $this->_modifiers['date'] = array($this, 'modifierDate');
    }

    public function modifierEscape($value, $format='d/m/Y')
    {
        return Mage::helper('core')->formatDate($value,$format);
    }

>

. .

+3

: {{var order.getShippingDate() | formatDateTime: F j, Y}}

-1

Source: https://habr.com/ru/post/1751025/


All Articles