public static function getFormatter($locale = null, $timezone = null, $date = true, $time = true, $seconds = false)
    {
        $locale = null === $locale ? \Locale::getDefault() : $locale;
        $date_format = \IntlDateFormatter::NONE;
        $time_format = \IntlDateFormatter::NONE;

        if ($date) {
            $date_format = \IntlDateFormatter::SHORT;
        }

        if ($time) {
            $time_format = $seconds ? \IntlDateFormatter::MEDIUM : \IntlDateFormatter::SHORT;
        }

        $formatter = new \IntlDateFormatter($locale, $date_format, $time_format, $timezone, \IntlDateFormatter::GREGORIAN, null);
        $formatter->setLenient(false);

        return $formatter;
    }
public static function getFormatter($locale = null, $timezone = null, $date = true, $time = true, $seconds = false)
    {
        $locale = null === $locale ? \Locale::getDefault() : $locale;
        $date_format = \IntlDateFormatter::NONE;
        $time_format = \IntlDateFormatter::NONE;

        if ($date) {
            $date_format = \IntlDateFormatter::SHORT;
        }

        if ($time) {
            $time_format = $seconds ? \IntlDateFormatter::MEDIUM : \IntlDateFormatter::SHORT;
        }

        $formatter = new \IntlDateFormatter($locale, $date_format, $time_format, $timezone, \IntlDateFormatter::GREGORIAN, null);
        $formatter->setLenient(false);

        return $formatter;
    }
public static function getFormatter ( $ locale = null , $ timezone = null , $ date = true , $ time = true , $ seconds = false ) { $ locale = null === $ locale ? \ Locale :: getDefault ( ) : $ locale ; $ date_format = \ IntlDateFormatter :: NONE ; $ time_format = \ IntlDateFormatter :: NONE ; if ( $ date ) { $ date_format = \ IntlDateFormatter :: SHORT ; } if ( $ time ) { $ time_format = $ seconds ? \ IntlDateFormatter :: MEDIUM : \ IntlDateFormatter :: SHORT ; } $ formatter = new \ IntlDateFormatter ( $ locale , $ date_format , $ time_format , $ timezone , \ IntlDateFormatter :: GREGORIAN , null ) ; $ formatter -> setLenient ( false ) ; return $ formatter ; }
Get the intl date formatter with the localized configuration.

@param string|null $locale   The locale
@param string|null $timezone The timezone
@param bool        $date     Check if the date must be displayed
@param bool        $time     Check if the time must be displayed
@param bool        $seconds  Check if the time must be displayed with seconds

@return \IntlDateFormatter
Get the intl date formatter with the localized configuration .