src/IntlService.php
public function formatDateTime(\DateTime $datetime, $format, $calendar = \IntlDateFormatter::GREGORIAN)
    {
        $types = array(
            \IntlDateFormatter::NONE,
            \IntlDateFormatter::NONE,
        );
        if (is_array($format)) {
            if (isset($format[0])) {
                $types[0] = $format[0];
            }
            if (isset($format[1])) {
                $types[1] = $format[1];
            }
            $pattern = null;
        } else {
            $pattern = $format;
        }
        $formatter = new \IntlDateFormatter(
            $this->currentLocale,
            $types[0],
            $types[1],
            $datetime->getTimezone()->getName(),
            $calendar,
            $pattern
        );
        return $formatter->format($datetime);
    }
public function formatDateTime(\DateTime $datetime, $format, $calendar = \IntlDateFormatter::GREGORIAN)
    {
        $types = array(
            \IntlDateFormatter::NONE,
            \IntlDateFormatter::NONE,
        );
        if (is_array($format)) {
            if (isset($format[0])) {
                $types[0] = $format[0];
            }
            if (isset($format[1])) {
                $types[1] = $format[1];
            }
            $pattern = null;
        } else {
            $pattern = $format;
        }
        $formatter = new \IntlDateFormatter(
            $this->currentLocale,
            $types[0],
            $types[1],
            $datetime->getTimezone()->getName(),
            $calendar,
            $pattern
        );
        return $formatter->format($datetime);
    }
public function formatDateTime ( \ DateTime $ datetime , $ format , $ calendar = \ IntlDateFormatter :: GREGORIAN ) { $ types = array ( \ IntlDateFormatter :: NONE , \ IntlDateFormatter :: NONE , ) ; if ( is_array ( $ format ) ) { if ( isset ( $ format [ 0 ] ) ) { $ types [ 0 ] = $ format [ 0 ] ; } if ( isset ( $ format [ 1 ] ) ) { $ types [ 1 ] = $ format [ 1 ] ; } $ pattern = null ; } else { $ pattern = $ format ; } $ formatter = new \ IntlDateFormatter ( $ this -> currentLocale , $ types [ 0 ] , $ types [ 1 ] , $ datetime -> getTimezone ( ) -> getName ( ) , $ calendar , $ pattern ) ; return $ formatter -> format ( $ datetime ) ; }
Format DateTime to current locale format.

@param \DateTime    $datetime DateTime to format.
@param string|array $format   Format string or array like [datetype, timetype].
@param int          $calendar IntlDateFormatter calendar to use.

@return string
Format DateTime to current locale format .