framework/i18n/Formatter.php
public function asDate($value, $format = null)
    {
        if ($format === null) {
            $format = $this->dateFormat;
        }

        return $this->formatDateTimeValue($value, $format, 'date');
    }
public function asDate($value, $format = null)
    {
        if ($format === null) {
            $format = $this->dateFormat;
        }

        return $this->formatDateTimeValue($value, $format, 'date');
    }
public function asDate ( $ value , $ format = null ) { if ( $ format === null ) { $ format = $ this -> dateFormat ; } return $ this -> formatDateTimeValue ( $ value , $ format , 'date' ) ; }
Formats the value as a date.
@param int|string|DateTime $value the value to be formatted. The following
types of value are supported:

- an integer representing a UNIX timestamp. A UNIX timestamp is always in UTC by its definition.
- a string that can be [parsed to create a DateTime object](https://secure.php.net/manual/en/datetime.formats.php).
The timestamp is assumed to be in [[defaultTimeZone]] unless a time zone is explicitly given.
- a PHP [DateTime](https://secure.php.net/manual/en/class.datetime.php) object. You may set the time zone
for the DateTime object to specify the source time zone.

The formatter will convert date values according to [[timeZone]] before formatting it.
If no timezone conversion should be performed, you need to set [[defaultTimeZone]] and [[timeZone]] to the same value.
Also no conversion will be performed on values that have no time information, e.g. `"2017-06-05"`.

@param string $format the format used to convert the value into a date string.
If null, [[dateFormat]] will be used.

This can be "short", "medium", "long", or "full", which represents a preset format of different lengths.
It can also be a custom format as specified in the [ICU manual](http://userguide.icu-project.org/formatparse/datetime).

Alternatively this can be a string prefixed with `php:` representing a format that can be recognized by the
PHP [date()](https://secure.php.net/manual/en/function.date.php)-function.

@return string the formatted result.
@throws InvalidArgumentException if the input value can not be evaluated as a date value.
@throws InvalidConfigException if the date format is invalid.
@see dateFormat
Formats the value as a date . @param int|string|DateTime $value the value to be formatted . The following types of value are supported :