Answers for "php formater une date en francais"

PHP
0

date en français - php

<?php
// setlocale(LC_TIME, 'fr_FR.UTF8');
// setlocale(LC_TIME, 'fr_FR');
// setlocale(LC_TIME, 'fr');
setlocale(LC_TIME, 'fra_fra');
 
echo strftime('%Y-%m-%d %H:%M:%S');  // 2012-10-11 16:03:04
echo strftime('%A %d %B %Y, %H:%M'); // jeudi 11 octobre 2012, 16:03
echo strftime('%d %B %Y');           // 11 octobre 2012
echo strftime('%d/%m/%y');           // 11/10/12
?>
Posted by: Guest on May-28-2020
0

convertir date php en français

// Convertit une date ou un timestamp en français
public static function dateToFrench($date, $format) 
{
    $english_days = array('Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday');
    $french_days = array('lundi', 'mardi', 'mercredi', 'jeudi', 'vendredi', 'samedi', 'dimanche');
    $english_months = array('January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December');
    $french_months = array('janvier', 'février', 'mars', 'avril', 'mai', 'juin', 'juillet', 'août', 'septembre', 'octobre', 'novembre', 'décembre');
    return str_replace($english_months, $french_months, str_replace($english_days, $french_days, date($format, strtotime($date) ) ) );
}
Posted by: Guest on August-19-2021

Browse Popular Code Answers by Language