i18n\Formatter normalizeDatetimeValue()

normalizeDatetimeValue() protected method

Normalizes the given datetime value as a DateTime object that can be taken by various date/time formatting methods.

protected DateTime|array normalizeDatetimeValue ( $value, $checkTimeInfo = false )
$value integer|string|DateTime

The datetime value to be normalized. The following types of value are supported:

$checkTimeInfo boolean

Whether to also check if the date/time value has some time information attached. Defaults to false. If true, the method will then return an array with the first element being the normalized timestamp and the second a boolean indicating whether the timestamp has time information or it is just a date value. This parameter is available since version 2.0.1.

return DateTime|array

The normalized datetime value. Since version 2.0.1 this may also return an array if $checkTimeInfo is true. The first element of the array is the normalized timestamp and the second is a boolean indicating whether the timestamp has time information or it is just a date value.

throws yii\base\InvalidParamException

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

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

Please login to continue.