0

I recently did an upgrade from Magento 1.8.0.0 to 1.9.2.3. Since then the Core Helper Function formatDate() returns the 'medium'-formatted date, even if called with 'short'.

Example (output from magerun dev:console):

Magento 1.8.0.0:

>>> Mage::helper('core')->formatDate('2011-06-28 08:50:51', 'short')
=> "28.06.11"
>>> Mage::helper('core')->formatDate('2011-06-28 08:50:51', 'medium')
=> "28.06.2011"

Magento 1.9.2.3:

>>> Mage::helper('core')->formatDate('2011-06-28 08:50:51', 'short')
=> "28.06.2011"
>>> Mage::helper('core')->formatDate('2011-06-28 08:50:51', 'medium')
=> "28.06.2011"

As far as I can see the formatDate() itself didn't change. Also my system configuration didn't change. Is it a bug? Can anybody reproduce? Thanks.

1 Answer 1

0

Since Magento CE 1.8.1.0, Mage_Core_Model_Locale::getDateFormat() always returns a four digit year part, no matter which date format is passed in.

To create the desired output format, you need to bypass the Mage_Core_Helper_Data::formatDate() method.

1
  • ah ok, I see. Didn't know it's 4 digits because of ISO. It did break some 3rd party module but in that case I leave it as is and better fix that extension. Thanks!
    – mnp
    Feb 1, 2016 at 13:07

Your Answer

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

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