par
AB » 20 mars 2011, 20:11
Utilise alors plutôt strftime pour avoir une date en français
$date_mysql = '2008-08-20 04:13:41';
function Date_fr($da)
{
setlocale(LC_TIME, "french");
$strtime = strtotime($da);
$jour = strftime('%A', $strtime);
$num_jour = strftime('%d', $strtime);
$mois = strftime('%B', $strtime);
$an = strftime('%Y', $strtime);
$heure = strftime('%H', $strtime);
$min = strftime('%M', $strtime);
return array('j'=>$jour,'num'=>$num_jour,'mois'=>$mois,'an'=>$an,'h'=>$heure,'m'=>$min);
}
echo '<br />';
print_r(Date_fr($date_mysql));
echo '<br />';
Suivant les cas tu pourras avoir à faire un utf8_encode sur le mois
Utilise alors plutôt strftime pour avoir une date en français
[php]$date_mysql = '2008-08-20 04:13:41';
function Date_fr($da)
{
setlocale(LC_TIME, "french");
$strtime = strtotime($da);
$jour = strftime('%A', $strtime);
$num_jour = strftime('%d', $strtime);
$mois = strftime('%B', $strtime);
$an = strftime('%Y', $strtime);
$heure = strftime('%H', $strtime);
$min = strftime('%M', $strtime);
return array('j'=>$jour,'num'=>$num_jour,'mois'=>$mois,'an'=>$an,'h'=>$heure,'m'=>$min);
}
echo '<br />';
print_r(Date_fr($date_mysql));
echo '<br />';
[/php]
Suivant les cas tu pourras avoir à faire un utf8_encode sur le mois