For all those, like me, who still cannot make strftime
function due to server restrictions... Not perfect but it works.
$months[1] = "gennaio";
$months[2] = "febbraio";
$months[3] = "marzo";
$months[4] = "aprile";
$months[5] = "maggio";
$months[6] = "giugno";
$months[7] = "luglio";
$months[8] = "agosto";
$months[9] = "settembre";
$months[10] = "ottobre";
$months[11] = "novembre";
$months[12] = "dicembre";
// giorni
$weekdays[0] = "domenica";
$weekdays[1] = "lunedì";
$weekdays[2] = "martedì";
$weekdays[3] = "mercoledì";
$weekdays[4] = "giovedì";
$weekdays[5] = "venerdì";
$weekdays[6] = "sabato";
function strftimeIta($format, $timestamp){
global $weekdays, $months;
preg_match_all('/%([a-zA-Z])/', $format, $results);
$originals = $results[0];
$factors = $results[1];
foreach($factors as $key=>$factor){
switch($factor){
case 'a':
/*** Abbreviated textual representation of the day ***/
$n = date('w', $timestamp); // number of the weekday (0 for sunday, 6 for saturday);
$replace = ucfirst($weekdays[$n]);
$replace = substr($replace, 0, 3);
break;
case 'A':
/*** Full textual representation of the day ***/
$n = date('w', $timestamp); // number of the weekday (0 for sunday, 6 for saturday);
$replace = ucfirst($weekdays[$n]);
break;
case 'h':
case 'b':
/*** Abbreviated month name ***/
$n = date('n', $timestamp); // Numeric representation of a month, without leading zeros
$replace = ucfirst($months[$n]);
$replace = substr($replace, 0, 3);
break;
case 'B':
/*** Full month name ***/
$n = date('n', $timestamp); // Numeric representation of a month, without leading zeros
$replace = ucfirst($months[$n]);
break;
default:
/*** Use standard strftime function ***/
$replace = strftime("%".$factor, $timestamp);
break;
}
$search = $originals[$key];
$format = str_replace($search, $replace, $format);
}
return $format;
}
'ca_ES'
for compatibility with other systems – Anglaangle