php - How to get the month name in French and year from a number -
is there way in php print month name , year in french when have number in format 52013 or 42013 ?
i have tried:
$month = 42013; $monthnr = substr($month, -5, 1); $timestamp = mktime(0, 0, 0, $monthnr, 1); $monthname = date('m', $timestamp ); echo $monthname; but result apr
i'd avril 2013
you simple array of month names
$months = array(1 => 'janvier', 2 => 'février'...); then month value
$monthname = $months[date('n', $timestamp )]; or based on comments suggestion (this based on answer in linked question)
setlocale(lc_all, 'fr_fr'); echo strftime('%b', $timestamp);
Comments
Post a Comment