1

I'm using "AW blog" in Magento 1.9.3.2. On the homepage I've got the recently added blogs with the date, the date is now showing: 29 May 2017. How can I change that into Dutch like; 29 Mei 2017? I've tried several thing I found on the internet but I couldn't get it to work :(

This is the code:

<div class="lt-blog-info <?php if($i==1) echo $this->__('info-first-blog')?>">
    <div class="item-lb-title">
        <a title="<?php echo substr($post->getTitle(), 0, 25);?>" href="<?php echo $post->getAddress(); ?>"><span><?php echo substr($post->getTitle(), 0, 25); ?></span>
        </a>
    </div>
    <div class="w-agoday">
        <?php
            $date = $post->getCreatedTime();
            $dateToShow = date('j F Y',strtotime($date));
            echo $dateToShow;
        ?>
    </div>
    <div class="item-lb-description">
        <?php echo substr(strip_tags($post->getShortContent()), 0, 120);  ?>
    </div>
</div>
3

You can try this:

// based on configuration
// $locale = Mage::app()->getLocale()->getLocaleCode();
$locale = 'nl_NL';
$date = new Zend_Date($post->getCreatedTime());
$date->setLocale($locale);
echo $date->toString(Zend_Date::DATE_LONG);

Other date formates here: https://framework.zend.com/manual/1.10/en/zend.date.constants.html

0

Use this one, is simpler :

<?php 
$date = new DateTime();
$date->setTimezone(new DateTimezone('Europe/Berlin'));
echo $date->format('d F Y'); // 28 June 2017 
?>
  • This does not give localized output. – sv3n Jun 28 '17 at 10:03
  • I have tested it and it works, and why the downvote ? – PЯINCƏ Jun 28 '17 at 10:31
  • B/c it doesn't work. He wants localized date. "28 juni 2017" instead of "28 June 2017" – sv3n Jun 28 '17 at 10:36
  • But because the title was just : Date format in dutch and you have edited it to Localized dutch date, and you are not here to test the solutions of others, let him to do it himself. – PЯINCƏ Jun 28 '17 at 10:44
  • 1
    Thank you for your answer, I've tried it but I got the current date in English. – n00bly Jun 28 '17 at 12:05

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.