Change Month Name To French


Answer :

Use strftime : http://php.net/manual/en/function.strftime.php

<?php setlocale(LC_TIME, "fr_FR"); echo strftime(" in French %d.%M.%Y and"); 

(not sure about that %d.%M.%Y but you can read documentation)


From http://php.net/manual/en/function.date.php:

To format dates in other languages, you should use the setlocale() and strftime() functions instead of date().


I know this is old but for anyone still looking this up, a more complete answer for your date in French would be:

//set locale setlocale(LC_TIME, "fr_FR");  

Then

//echo date/formatting based on your locale, in this case, for French echo strftime("le %d %B, %Y", strtotime( $sgps_newsletter->getCreatedAt() )); //without day of the week = le 18 septembre, 2013 

OR

echo strftime("%A le %d %B, %Y", strtotime( $sgps_newsletter->getCreatedAt() )); //with day of the week = mercredi le 18 septembre, 2013 

OR

echo strftime("%d/%m/%Y", strtotime( $sgps_newsletter->getCreatedAt() )) //numerical, separated by '/' = 18/9/2013 

Comments

Popular posts from this blog

Are Regular VACUUM ANALYZE Still Recommended Under 9.1?

Can Feynman Diagrams Be Used To Represent Any Perturbation Theory?