0

If I use

<?php echo "Valid until: "; echo strtolower(date('j. M. Y', strtotime($this->getPdfHelper()->getOrderDate()." +5 days")))?>

I get proper result, but month is displayed in English, not in Magento locale.

If I use

<?php echo Mage::helper('catalog')->__('Valint until')?>: <?php echo $this->getPdfHelper()->getOrderDate() + (5*24*60*60), true, $format?><br/>

Result is "Valid until: 4320031"

Any suggestion, how to add days to getOrderDate() so result will be in Magento locale, with "j. M. Y" date format?

1 Answer 1

1

Try:

/** @var Zend_Date $date */
$date = Mage::app()->getLocale()->date(strtotime($this->getPdfHelper()->getOrderDate() . " +5 days"));
$date->setOptions(array('format_type' => 'php'));
echo $date->toString('j.M.Y');

Hope it helps

3
  • Thank you, it works - shows date in correct format and language, but causes another problem. In following code, I use <?php echo $history['date'] ?> and now instead of correct date format, it shows 12. MMMMMMMMM. 00002014? Any idea how to solve this for both date instances? May 1, 2016 at 18:12
  • What is $history? May 1, 2016 at 18:31
  • <?php $commentHistory = $pdfHelper->OutputCommentHistory() ?> <?php if ($commentHistory) : ?> <br/> <strong><?php echo Mage::helper('sales')->__('Status order') ?></strong><br/> <table border="0" cellpadding="2" cellspacing="0"> <?php foreach ($commentHistory as $history): ?> <tr> <td><?php echo $history['date'] ?><?php if ($history['label']): ?> | <?php echo $history['label'] ?><?php endif; ?></td> <td><?php echo $history['comment'] ?></td> </tr> <?php endforeach; ?> </table> <br/> <?php endif; ?> May 1, 2016 at 19:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.