Text.php
public static function formatDate(DateTime $date, $locale = null, bool $short = false)
    {
        $locale = $locale ?? 'fr';
        $localDates = [
            'fr'    => $short ? 'd/m/y' : 'd/m/Y',
            'en'    => $short ? 'd/m/y' : 'd/m/Y',
            'en_US' => $short ? 'm/d/y' : 'm/d/Y'
        ];
        return (string) $date->format($localDates[$locale]);
    }
public static function formatDate(DateTime $date, $locale = null, bool $short = false)
    {
        $locale = $locale ?? 'fr';
        $localDates = [
            'fr'    => $short ? 'd/m/y' : 'd/m/Y',
            'en'    => $short ? 'd/m/y' : 'd/m/Y',
            'en_US' => $short ? 'm/d/y' : 'm/d/Y'
        ];
        return (string) $date->format($localDates[$locale]);
    }
public static function formatDate ( DateTime $ date , $ locale = null , bool $ short = false ) { $ locale = $ locale ?? 'fr' ; $ localDates = [ 'fr' => $ short ? 'd/m/y' : 'd/m/Y' , 'en' => $ short ? 'd/m/y' : 'd/m/Y' , 'en_US' => $ short ? 'm/d/y' : 'm/d/Y' ] ; return ( string ) $ date -> format ( $ localDates [ $ locale ] ) ; }
Format a date with the specified locale
@param DateTime $date
@param string $locale
@param bool $short
@return string
@todo use an external library ?
Format a date with the specified locale