<?php
//setDateLT
//Converts date format
//Use: [[setDateLT? &date=`[[*publishedon]]`]]
// months in Lithuanian
$months = array(1 => "sausio", //January
2 => "vasario", //February
3 => "kovo", //March
4 => "balandžio", //April
5 => "gegužės", //May
6 => "birželio", //Jun
7 => "liepos", //July
8 => "rugpjūčio", //August
9 => "rugsėjo", //September
10=> "spalio", //October
11=> "lapkričio", //November
12=> "gruodžio"); //December
$mj = date("n", strtotime($date));
// days in Lithuanian
$days = array(1 => "pirmadienis", // Monday
2 => "antradienis", //Thuesday
3 => "trečiadienis", //Wensday
4 => "ketvirtadienis", //Thursday
5 => "penktadienis", // Friday
6 => "šeštadienis", //Saturday
7 => "sekmadienis"); //Sunday
$dy = date("N", strtotime($date));
//Get vars
$fullday = $days[$dy]; // For example Monday
$month = $months[$mj]; // For example January
$day = date("d", strtotime($date)); //For example 28
$year = date("Y", strtotime($date));// For example 2012
//display date format example:
//2014 m. kovo 11 d.
return $year.' m. '.$month.' '.$day.' d. ';FYI: date() doesn't respect the locale setting -- strftime() does. Using strftime() will give you the language-appropriate month and day names.
You can always call setlocale() just before calling strftime().

nl_NL
nl_NL.UTF-8
<?php
//langDate
//Converts date format
//Use: [[langDate? &date=`[[*publishedon]]`]]
$modx->lexicon->load('core:default');
$month = strtolower(date('F', strtotime($date) ));
$day = strtolower(date('l', strtotime($date) ));
$dy = date("N", strtotime($date));
$fullday = $modx->lexicon($day); //Monday in current language
$month = $modx->lexicon($month);//May in current language
$day = date("d", strtotime($date)); // 13
$year = date("Y", strtotime($date)); // 2014
return $fullday.', '.$day.'. '.$month.' '.$year;
<?php
$locale = $modx->context->getOption('locale', null, 'default');
setlocale(LC_ALL,$locale.'.UTF-8');
$eventName = $modx->event->name;
if($modx->context->get('key') == 'mgr' || $eventName != 'OnHandleRequest') { return ''; }
$hostname = $_SERVER['HTTP_HOST'];
switch($hostname) {
case 'mywebsite.de':
$modx->switchContext('deutsch');
setlocale(LC_ALL,$modx->context->getOption('locale', null, 'default'));
break;
}
For me with MODX 2.3.5-pl
in "system settings > core > locale"
setting the value to "de_DE"
works fine for german language settings with strftime()