Different language on date

question if website is in english and I just want one section within that site to display the dates in another language is that possible?

e.g. english
[[+publishedon:date=%B]]

but i want just that in diff lang e.g. arabic
I thought this might work but it does not
[[+publishedon:date=%B:lang=ar]]

Any ideas?

modx 3.0.2
pho 8.1

you could create your own output filter using intlDateFormatter

many thanks for that will try

thanks for the tip @bruno17

in case anyone else got the same / similar question as me

/*
use like this [[*publishedon:strtotime:dateMonthLang=`zh`]]
//snippet called dateMonthLang
*/
$input = !empty($input) ? $input : '';
$options = !empty($options) ? $options : 'en';
$formatter = new IntlDateFormatter($options, NULL, NULL);
$formatter->setPattern('MMMM'); 
$output= $formatter->format($input); 
return $output;
1 Like

This topic was automatically closed 2 days after discussion ended and a solution was marked. New replies are no longer allowed. You can open a new topic by clicking the link icon below the original post or solution and selecting “+ New Topic”.