IntlDateFormatter::formatObject() - IntlDateFormatter类
IntlDateFormatter::formatObject()
datefmt_format_object
(PHP 5 >= 5.5.0, PHP 7, PECL intl >= 3.0.0)
Formats an object
说明
面向对象风格publicstaticIntlDateFormatter::formatObject(object $object[,mixed $format= NULL[,string $locale= NULL]]): string过程化风格
publicstaticdatefmt_format_object(object $object[,mixed $format= NULL[,string $locale= NULL]]): string
This function allows formatting an IntlCalendar or DateTime object without first explicitly creating a IntlDateFormatter object.
The temporary IntlDateFormatter that will be created will take the timezone from the passed in object. The timezone database bundled with PHP will not be used – ICU's will be used instead. The timezone identifier used in DateTime objects must therefore also exist in ICU's database.
参数
$objectAn object of type IntlCalendar or DateTime. The timezone information in the object will be used.
$format How to format the date/time. This can either be an array with two elements(first the date style, then the time style, these being one of the constants IntlDateFormatter::NONE
,IntlDateFormatter::SHORT
,IntlDateFormatter::MEDIUM
,IntlDateFormatter::LONG
,IntlDateFormatter::FULL
), an integer with the value of one of these constants(in which case it will be used both for the time and the date)or a string with the format described in » the ICU documentation. If NULL
, the default style will be used.
The locale to use, or NULL
to use the default one.
返回值
A string with result 或者在失败时返回FALSE
.
范例
IntlDateFormatter::formatObject() examples
鹏仔微信 15129739599 鹏仔QQ344225443 鹏仔前端 pjxi.com 共享博客 sharedbk.com
图片声明:本站部分配图来自网络。本站只作为美观性配图使用,无任何非法侵犯第三方意图,一切解释权归图片著作权方,本站不承担任何责任。如有恶意碰瓷者,必当奉陪到底严惩不贷!