📄 class.intldateformatter.html
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><html> <head> <title>The IntlDateFormatter class</title> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> </head> <body><div style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="book.intl.html">intl</a></div> <div class="next" style="text-align: right; float: right;"><a href="intldateformatter.create.html">IntlDateFormatter::create</a></div> <div class="up"><a href="book.intl.html">intl</a></div> <div class="home"><a href="index.html">PHP Manual</a></div></div><hr /><div> <h1 class="title">The IntlDateFormatter class</h1> <div class="partintro"> <div id="intldateformatter.intro" class="section"> <h2 class="title">Introduction</h2> <p class="simpara"> Date Formatter is a concrete class that enables locale-dependent formatting/parsing of dates using pattern strings and/or canned patterns. </p> <p class="simpara"> This class represents the ICU date formatting functionality. It allows users to display dates in a localized format or to parse strings into PHP date values using pattern strings and/or canned patterns. </p> </div> <div id="intldateformatter.synopsis" class="section"> <h2 class="title">Class synopsis</h2> <div class="classsynopsis"> <div class="ooclass"> <b class="classname">IntlDateFormatter</b> </div> <div class="classsynopsisinfo"> <span class="ooclass"> <b class="classname">IntlDateFormatter</b> </span> {</div> <div class="classsynopsisinfo classsynopsisinfo_comment">/* Methods */</div> <div class="constructorsynopsis dc-description"> <span class="methodname"><b><a href="intldateformatter.create.html" class="function">IntlDateFormatter::__construct</a></b></span> ( <span class="methodparam"><span class="type">string</span> <tt class="parameter">$locale</tt></span> , <span class="methodparam"><span class="type">integer</span> <tt class="parameter">$datetype</tt></span> , <span class="methodparam"><span class="type">integer</span> <tt class="parameter">$timetype</tt></span> [, <span class="methodparam"><span class="type">string</span> <tt class="parameter">$timezone</tt></span> [, <span class="methodparam"><span class="type">integer</span> <tt class="parameter">$calendar</tt></span> [, <span class="methodparam"><span class="type">string</span> <tt class="parameter">$pattern</tt></span> ]]] )</div> <div class="methodsynopsis dc-description"> <span class="modifier">static</span> <span class="type">IntlDateFormatter</span> <span class="methodname"><b><a href="intldateformatter.create.html" class="function">IntlDateFormatter::create</a></b></span> ( <span class="methodparam"><span class="type">string</span> <tt class="parameter">$locale</tt></span> , <span class="methodparam"><span class="type">integer</span> <tt class="parameter">$datetype</tt></span> , <span class="methodparam"><span class="type">integer</span> <tt class="parameter">$timetype</tt></span> [, <span class="methodparam"><span class="type">string</span> <tt class="parameter">$timezone</tt></span> [, <span class="methodparam"><span class="type">integer</span> <tt class="parameter">$calendar</tt></span> [, <span class="methodparam"><span class="type">string</span> <tt class="parameter">$pattern</tt></span> ]]] )</div><div class="methodsynopsis dc-description"> <span class="type">string</span> <span class="methodname"><b><a href="intldateformatter.format.html" class="function">IntlDateFormatter::format</a></b></span> ( <span class="methodparam"><span class="type"><a href="language.pseudo-types.html#language.types.mixed" class="type mixed">mixed</a></span> <tt class="parameter">$value</tt></span> )</div><div class="methodsynopsis dc-description"> <span class="type">integer</span> <span class="methodname"><b><a href="intldateformatter.getcalendar.html" class="function">IntlDateFormatter::getCalendar</a></b></span> ( <span class="methodparam">void</span> )</div><div class="methodsynopsis dc-description"> <span class="type">integer</span> <span class="methodname"><b><a href="intldateformatter.getdatetype.html" class="function">IntlDateFormatter::getDateType</a></b></span> ( <span class="methodparam">void</span> )</div><div class="methodsynopsis dc-description"> <span class="type">integer</span> <span class="methodname"><b><a href="intldateformatter.geterrorcode.html" class="function">IntlDateFormatter::getErrorCode</a></b></span> ( <span class="methodparam">void</span> )</div><div class="methodsynopsis dc-description"> <span class="type">string</span> <span class="methodname"><b><a href="intldateformatter.geterrormessage.html" class="function">IntlDateFormatter::getErrorMessage</a></b></span> ( <span class="methodparam">void</span> )</div><div class="methodsynopsis dc-description"> <span class="type">string</span> <span class="methodname"><b><a href="intldateformatter.getlocale.html" class="function">IntlDateFormatter::getLocale</a></b></span> ([ <span class="methodparam"><span class="type">integer</span> <tt class="parameter">$which</tt></span> ] )</div><div class="methodsynopsis dc-description"> <span class="type">string</span> <span class="methodname"><b><a href="intldateformatter.getpattern.html" class="function">IntlDateFormatter::getPattern</a></b></span> ( <span class="methodparam">void</span> )</div><div class="methodsynopsis dc-description"> <span class="type">integer</span> <span class="methodname"><b><a href="intldateformatter.gettimetype.html" class="function">IntlDateFormatter::getTimeType</a></b></span> ( <span class="methodparam">void</span> )</div><div class="methodsynopsis dc-description"> <span class="type">string</span> <span class="methodname"><b><a href="intldateformatter.gettimezoneid.html" class="function">IntlDateFormatter::getTimeZoneId</a></b></span> ( <span class="methodparam">void</span> )</div><div class="methodsynopsis dc-description"> <span class="type">boolean</span> <span class="methodname"><b><a href="intldateformatter.islenient.html" class="function">IntlDateFormatter::isLenient</a></b></span> ( <span class="methodparam">void</span> )</div><div class="methodsynopsis dc-description"> <span class="type">array</span> <span class="methodname"><b><a href="intldateformatter.localtime.html" class="function">IntlDateFormatter::localtime</a></b></span> ( <span class="methodparam"><span class="type">string</span> <tt class="parameter">$value</tt></span> [, <span class="methodparam"><span class="type">integer</span> <tt class="parameter reference">&$position</tt></span> ] )</div><div class="methodsynopsis dc-description"> <span class="type">integer</span> <span class="methodname"><b><a href="intldateformatter.parse.html" class="function">IntlDateFormatter::parse</a></b></span> ( <span class="methodparam"><span class="type">string</span> <tt class="parameter">$value</tt></span> [, <span class="methodparam"><span class="type">integer</span> <tt class="parameter reference">&$position</tt></span> ] )</div><div class="methodsynopsis dc-description"> <span class="type">boolean</span> <span class="methodname"><b><a href="intldateformatter.setcalendar.html" class="function">IntlDateFormatter::setCalendar</a></b></span> ( <span class="methodparam"><span class="type">integer</span> <tt class="parameter">$which</tt></span> )</div><div class="methodsynopsis dc-description"> <span class="type">boolean</span> <span class="methodname"><b><a href="intldateformatter.setlenient.html" class="function">IntlDateFormatter::setLenient</a></b></span> ( <span class="methodparam"><span class="type">boolean</span> <tt class="parameter">$lenient</tt></span> )</div><div class="methodsynopsis dc-description"> <span class="type">boolean</span> <span class="methodname"><b><a href="intldateformatter.setpattern.html" class="function">IntlDateFormatter::setPattern</a></b></span> ( <span class="methodparam"><span class="type">string</span> <tt class="parameter">$pattern</tt></span> )</div><div class="methodsynopsis dc-description"> <span class="type">boolean</span> <span class="methodname"><b><a href="intldateformatter.settimezoneid.html" class="function">IntlDateFormatter::setTimeZoneId</a></b></span> ( <span class="methodparam"><span class="type">string</span> <tt class="parameter">$zone</tt></span> )</div> }</div> </div> <div id="intldateformatter.seealso" class="section"> <h2 class="title">See Also</h2> <p class="para"> <ul class="simplelist"> <li class="member"> <a href="http://www.icu-project.org/apiref/icu4c/classDateFormat.html#_details" class="link external">» ICU Date formatter</a> </li> </ul> </p> </div> <div id="intl.intldateformatter-constants" class="section"><h2 class="title">Predefined Constants</h2><p class="para"> These constants are used to specify different formats in the constructor for DateType and TimeType. <dl> <dt> <span class="term"> <b><tt>IntlDateFormatter::NONE</tt></b> (<a href="language.types.string.html" class="type string">string</a>) </span> <dd> <span class="simpara">Do not include this element</span> </dd> </dt> <dt> <span class="term"> <b><tt>IntlDateFormatter::FULL</tt></b> (<a href="language.types.string.html" class="type string">string</a>) </span> <dd> <span class="simpara">Completely specified style (Tuesday, April 12, 1952 AD or 3:30:42pm PST)</span> </dd> </dt> <dt> <span class="term"> <b><tt>IntlDateFormatter::LONG</tt></b> (<a href="language.types.string.html" class="type string">string</a>) </span> <dd> <span class="simpara">Long style (January 12, 1952 or 3:30:32pm)</span> </dd> </dt> <dt> <span class="term"> <b><tt>IntlDateFormatter::MEDIUM</tt></b> (<a href="language.types.string.html" class="type string">string</a>) </span> <dd> <span class="simpara">Medium style (Jan 12, 1952)</span> </dd> </dt> <dt> <span class="term"> <b><tt>IntlDateFormatter::SHORT</tt></b> (<a href="language.types.string.html" class="type string">string</a>) </span> <dd> <span class="simpara">Most abbreviated style, only essential data (12/13/52 or 3:30pm)</span> </dd> </dt> </dl> </p> </div> <div id="intl.intldateformatter-constants.calendartypes" class="section"> <p class="para"> The following int constants are used to specify the calendar. These calendars are all based directly on the Gregorian calendar. Non-Gregorian calendars need to be specified in locale. Examples might include locale="hi@calendar=BUDDHIST". <dl> <dt> <span class="term"> <b><tt>IntlDateFormatter::TRADITIONAL</tt></b> (<a href="language.types.string.html" class="type string">string</a>) </span> <dd> <span class="simpara">Non-Gregorian Calendar</span> </dd> </dt> <dt> <span class="term"> <b><tt>IntlDateFormatter::GREGORIAN</tt></b> (<a href="language.types.string.html" class="type string">string</a>) </span> <dd> <span class="simpara">Gregorian Calendar</span> </dd> </dt> </dl> </p> </div> </div> <h2>Table of Contents</h2><ul class="chunklist chunklist_reference"><li><a href="intldateformatter.create.html">IntlDateFormatter::create</a> 鈥
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -