PHP : fonction date() en français : date_fr()
15 04 2010La fonction date(format, <timestamp>) retourne une chaîne de caractère correspondant à une date au format passé en paramètre.
Le problème c’est qu’elle parle anglais cette fonction : le nom des mois et des jours ne sont pas traduit.
Voici la même fonction, mais traduite en français :
function date_fr($format = 'l j F Y, H:i', $time = null){ if(empty($time)) $time = time(); $date = date($format, $time); $jour_en = array("Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"); $jour_fr = array("Lundi","Mardi","Mercredi","Jeudi","Vendredi","Samedi","Dimanche"); $mois_en = array("January","February","March","April","May","June","July","August","September","October","November","December"); $mois_fr = array("Janvier","Février","Mars","Avril","Mai","Juin","Juillet","Août","Septembre","Octobre","Novembre","Décembre"); $date = str_replace($jour_en, $jour_fr, $date); $date = str_replace($mois_en, $mois_fr, $date); return $date; }
Cette version marche beaucoup mieux que la bidouille qui consiste à utiliser les fonctions setlocale( LC_TIME, “fr” ); et strftime :
function dateFR( $time ){ setlocale( LC_TIME, "fr" ); return strftime( "%A %d %b %Y" , strtotime( $time ) ); }
I have been exploring for a little bit for any high-quality articles or weblog posts in this kind
of house . Exploring in Yahoo I at last stumbled upon this web site.
Studying this info So i’m happy to express that I have an incredibly good
uncanny feeling I found out exactly what I needed.
I so much unquestionably will make sure to
do not omit this site and give it a glance on a continuing basis.
If yoou don’t want to get involved in spread
betting thern don’t worry, fixed odds betting is offered at
Spreadex also.
my site 해외토토사이트
It is mainly foreigners who have access to offline and online
websites inn South Korea.
Feel free tto visit my blog post - click here