note 36273 deleted from function.date by didou
| From: | didou@php.net | Date: | Fri, 03 Oct 2003 08:10:26 +0000 |
| Subject: | note 36273 deleted from function.date by didou | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-57663@lists.php.net to get a copy of this message | ||
Note Submitter: cocosnake@cocosnake
----
en: This is a french version of the function date()
fr: Voici une version française de la fonction date()
<?
function datefr ($format, $timestamp = null)
{
$tTrans = Array (
"lw" => Array ( "Dimanche", "Lundi", "Mardi",
"Mercredi", "Jeudi", "Vendredi", "Samedi" ),
"Dw" => Array ( "Dim", "Lun", "Mar", "Mer",
"Jeu", "Ven", "Sam" ),
"Fn" => Array ( "", "Janvier", "Février",
"Mars", "Avril", "Mai", "Juin", "Juillet",
"Août", "Septembre", "Octobre", "Novembre",
"Décembre" ),
"Mn" => Array ( "", "Jan", "Fév", "Mar",
"Avr", "Mai", "Jun", "Jui", "Aou",
"Sep", "Oct", "Nov", "Déc" ),
"Sj" => Array ( "", "er", "eme" ) );
if ($timestamp == null)
$timestamp = time ();
foreach ($tTrans as $ref => $tVal)
$format = str_replace ($ref [0], "\\\\\\".$ref [0], $format);
$format = date ($format, $timestamp);
foreach ($tTrans as $ref => $tVal)
$format = str_replace ("\\".$ref [0], $tVal [min (date ($ref [1], $timestamp), count
($tVal)-1)], $format);
return $format;
}
?>