i18n\Formatter asDatetime()

asDatetime() public method

Formats the value as a datetime.

See also $datetimeFormat.

public string asDatetime ( $value, $format = null )
$value integer|string|DateTime

The value to be formatted. The following types of value are supported:

$format string

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.

Alternatively this can be a string prefixed with php: representing a format that can be recognized by the PHP date()-function.

return string

The formatted result.

throws yii\base\InvalidParamException

if the input value can not be evaluated as a date value.

throws yii\base\InvalidConfigException

if the date format is invalid.

doc_Yii
2016-10-30 17:05:57
Comments
Leave a Comment

Please login to continue.