Questo
Codice PHP:
<?php
// il %#d funziona sotto windows in linux è %e
setlocale(LC_TIME, "nld");
$t1=strftime("%A %#d %B %Y", time());
$t2=strftime("%A %#d %B %Y", time()+(24*60*60));
echo "Oggi: $t1
Domani: $t2
";
setlocale(LC_TIME, "ita");
$t1=strftime("%A %#d %B %Y", time());
$t2=strftime("%A %#d %B %Y", time()+(24*60*60));
echo "Oggi: $t1
Domani: $t2
";
?>
produce questo
codice:
Oggi: maandag 13 december 2010
Domani: dinsdag 14 december 2010
Oggi: lunedì 13 dicembre 2010
Domani: martedì 14 dicembre 2010
Attenzione, il %#d funziona solo sotto windows. In ambiente linux si utilizza %e. Sul manuale propongono questo codice cross platform
Codice PHP:
<?php
$format = '%e';
// Check for Windows and only attempt to replace
// the %e modifiers if they exists in the format
if (strtoupper(substr(PHP_OS, 0, 3)) == 'WIN' && strpos($format, '%e') !== false) {
$format = str_replace('%e', '%#d', $format);
}
echo strftime($format);
?>
infine se te la vuoi cavare rapidamente al posto di %e o %#d puoi utilizzare %d per tutto. La differenza sta nel fatto che mentre con %e hai i giorni da 1 a 31 con %d li hai da 01 a 31.