php - Hide time in transaction mails with {{var order.getCreatedAtFormated(''short'')}} -
i have little problem. want display date without time in order mails.
for have use {{var order.getcreatedatformated(''short'')}}
afaik. still showing time. of course searched magento source , wondering why it's not working.
when app/code/core/mage/sales/model/order.php
can find that:
/** * formated order created date in store timezone * * @param string $format date format type (short|medium|long|full) * @return string */ public function getcreatedatformated($format) { return mage::helper('core')->formatdate($this->getcreatedatstoredate(), $format, true); }
looking further /app/code/core/mage/core/helper/data.php
shows this:
public function formatdate($date = null, $format = mage_core_model_locale::format_type_short, $showtime = false) { if (!in_array($format, $this->_allowedformats, true)) { return $date; } if (!($date instanceof zend_date) && $date && !strtotime($date)) { return ''; } if (is_null($date)) { $date = mage::app()->getlocale()->date(mage::getsingleton('core/date')->gmttimestamp(), null, null); } else if (!$date instanceof zend_date) { $date = mage::app()->getlocale()->date(strtotime($date), null, null); } if ($showtime) { $format = mage::app()->getlocale()->getdatetimeformat($format); } else { $format = mage::app()->getlocale()->getdateformat($format); } return $date->tostring($format); }
so shouldn't hide time when pass short argument function?
mage::helper('core')->formatdate(null, mage_core_model_locale::format_type_short, false);
the last parameter allows time hidden:
public function formatdate($date = null, $format = mage_core_model_locale::format_type_short, $showtime = false)
that annoying of magento really, provide wrapper method not provide full access. why haven't written method following don't know...
public function getcreatedatformated($format, $showtime = true) { return mage::helper('core')->formatdate($this->getcreatedatstoredate(), $format, $showtime); }
Comments
Post a Comment