Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Convert date to french format in PHP without using locals
function to_french_format($date){
$date = date("l d/m/Y h:i", strtotime($date));
$date_components = split(' ',$date);
$french_days = array(
$key = $date_components[0];
if(array_key_exists($key, $french_days)){
$date = str_replace($key,$french_days[$key],$date);
return $date;
$originalDate = '2016-03-01 10:20:30';
echo to_french_format($originalDate);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment