Date format in different languages

Hi there,

On themes/Frontend/Bare/frontend/blog/box.tpl you have the follow block:

{* Date *}
{block name='frontend_blog_col_meta_data_date'}
    {if $sArticle.displayDate}

In our case we want to show date in a different format like:

{$sArticle.displayDate|date_format:"%d %B %Y"}

The problem is the output doesn’t take in account the selected shop localization for month translation. It always show us “28 June 2016”. In a german shop it would show us “28 Juni 2016”, but no.

How to fix this in Shopware?


Thanks for helping

hi cboita,

its not a shopware problem.

$month = date('F');
echo $month;

_‚F‘ A full textual representation of a month, such as January or March -> January through_December

You have to translate it by your own, like :

$lang = 'de';
$translate['de'] = array('Januar', 'Februar', 'März', ...);
$translate['en'] = array('January', 'February', 'March', ...);
$month = date('n');
echo $translate[$lang][$month-1];

you could do it with a plugin or try it with smarty.

smarty modifier:




1 Like