2

I want to translate the displayed date into Dutch. My current code looks like this:

<?php
$post = $this->getPost();
$date = Mage::getModel('core/date');
?>

<span class="date"><?php echo $date->date('d F Y', $post->getCreatedTime()); ?></span>

But that does display the date as 07 March 2016. I want to translate the Month to Dutch, so it will be 7 Maart 2016.

How can I achieve that?

6

Mage_Core_Helper_Data::format() it will format the date according to the locale settings.

Mage::helper('core')->formatDate($date->date('d F Y', $post->getCreatedTime()), 'medium', false);

reference for understanding the date better

1
  • 1
    That's maybe a better/more Magento solution.
    – Niels
    Mar 7 '16 at 11:11
0

You can do this by setting the locale to Dutch:

setlocale(LC_TIME, 'NL_nl');

1

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.