The date in French with PHP
Display the date with PHP? Nothing easier, as long as you want it in American format. If you want to display the date in French
form, you'll need to use a tip for this result:
Nous sommes le :
Samedi 07 Novembre 2009
To obtain this result, simply insert this PHP script in the location where you want to display the date on your page:
<?
$jour["Monday"] = "Lundi";
$jour["Tuesday"] = "Mardi";
$jour["Wednesday"] = "Mercredi";
$jour["Thursday"] = "Jeudi";
$jour["Friday"] = "Vendredi";
$jour["Saturday"] = "Samedi";
$jour["Sunday"] = "Dimanche";
function getJour($day) {
return $jour[$day];
}
$mois["January"] = "Janvier";
$mois["Febrary"] = "Février";
$mois["March"] = "Mars";
$mois["April"] = "Avril";
$mois["May"] = "Mai";
$mois["June"] = "Juin";
$mois["July"] = "Juillet";
$mois["August"] = "Août";
$mois["September"] = "Septembre";
$mois["October"] = "Octobre";
$mois["November"] = "Novembre";
$mois["December"] = "Décembre";
function getMois($month){
return $mois[$month];
}
$month = Date(F);
$day = Date(l);
getJour($day);
getMois($month);
print "Nous sommes le : <B>";
print "$jour[$day] ";
print Date(d)." ";
print "$mois[$month] ";
print Date(Y);
print "</B>";
?>
You can easily personalize this script by changing the layout of your date. To do this, simply modify the two print instructions
used to insert the HTML layout code (
print "Nous sommes le : <B>"; and
print "</B>";)
Discover all Webmaster tips.