1

I have a news page in my magento store which is displaying news posts with a publish date, my store is built in 2 languages, the code which is creating the format:

public function getPublishDate($format = 'd F Y')
    {
        return $this->getDateCreatedFormated($format);
    }

This is the code in my Code\Model folder.

The problem is in, both languages the month is shown in English, how can i make sure the English pays shows the English date, and my other language, shows, ofcourse, the other languaeg.

1
  • It will help if you post the code in the method getDateCreatedFormated you are using – ProxiBlue Mar 25 '15 at 22:25
2

Not having seen the code that you have, which formats your date, I am not sure if you are already using the correct formatting 'the magento way'

However, in case not, try this, and see if it works: (note, have not tested this)

See Mage_Core_Helper_Data::format(), which claims it will format the date according to the locale settings.

/**
 * Format date using current locale options
 *
 * @param   date|Zend_Date|null $date in GMT timezone
 * @param   string $format (full, long, medium, short)
 * @param   bool $showTime
 * @return  string
 */
public function formatDate($date=null, $format='short', $showTime=false)
{
....
}

so a call like this will potentially result in the correct 'locale specific' result:

Mage::helper('core')->formatDate($dateToFormat, 'medium', false);

Hope that helps.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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