作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在尝试在 Magento 中重写我的 PDF 发票。如何在没有订单日期的情况下显示创建时间?
我正在/app/code/local/Mage/Sales/Model/Order/Pdf/Abstract.php 中准备类 insertOrder()。
$page->drawText(Mage::helper('core')->formatDate($order->getCreatedAtStoreDate(), 'short', false), 100, 100, 'UTF-8');
最佳答案
仅显示时间部分的一种方法是:
$sTime = Mage::app()
->getLocale()
->date(strtotime($order->getCreatedAtStoreDate()), null, null, false)
->toString('H:m:s');
$page->drawText($sTime, 100, 100, 'UTF-8');
Zend_Date
日期/时间操作类。
toString()
app/code/core/Zend/Date.php
的方法用于参数信息。
关于date - 如何在 Magento 中获取订单时间?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12540465/
我是一名优秀的程序员,十分优秀!