I am trying to rewrite my PDF invoices in Magento. How can i display the created time without the date of a Order?
I am preparing the class insertOrder() in /app/code/local/Mage/Sales/Model/Order/Pdf/Abstract.php.
$page->drawText(Mage::helper('core')->formatDate($order->getCreatedAtStoreDate(), 'short', false), 100, 100, 'UTF-8');
shows only the time in combination with date.
One way to display the time part only would be this:
$sTime = Mage::app()
->getLocale()
->date(strtotime($order->getCreatedAtStoreDate()), null, null, false)
->toString('H:m:s');
$page->drawText($sTime, 100, 100, 'UTF-8');
Magento's locale uses a modified Zend_Date
class for date/time operations.
See the toString()
method of app/code/core/Zend/Date.php
for parameter infos.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With