PHP date in French

PHP date in French


Posted in : PHP Posted on : February 1, 2011 at 5:51 PM Comments : [ 0 ]

In this tutorial you will learn about PHP date in French in a PHP web application.

PHP date in French

In this tutorial you will learn about  PHP date in French  in a PHP web application. The code of "php-date-in-french.php" given below :

<?php
// enter date format 2011-01-31 (Y-m-d)
function date_in_french ($date){
$week_name = array("Dimanche","Lundi","Mardi","Mercredi","Jeudi","Vendredi","Samedi");
$month_name=array("","Janvier","F�©vrier","Mars","Avril","Mai","Juin","Juillet","Ao�»t",
"Septembre","Octobre","Novembre","D�©cembre");

$split = preg_split('/-/', $date);
$year = $split[0];
$month = round($split[1]);
$day = round($split[2]);

$week_day = date("w", mktime(12, 0, 0, $month, $day, $year));
return $date_fr = $week_name[$week_day] .' '. $day .' '. $month_name[$month] .' '. $year;
}
$currentDate=date('Y-m-d');
echo "Currnet Date :: ";
echo date('D')." ".date('d')." ".date('M')." ".date('Y');
echo "<br>";
echo "Date in French => ".date_in_french($currentDate);
?>

Output :

When run "php-date-in-french.php" display output as :

Download Source Code

Go to Topic «PreviousHomeNext»

Your Comment:


Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image
 
 

 
Tutorial Topics