note 105460 added to intldateformatter.create
| From: | daniel dot rhodes at warpasylum dot co dot uk | Date: | Fri, 19 Aug 2011 14:41:05 +0000 |
| Subject: | note 105460 added to intldateformatter.create | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-182590@lists.php.net to get a copy of this message | ||
It should be noted that the locale string passed into IntlDateFormatter's constructor supports
UCA keywords. So you can, for example, do things like this to output the year as a Japanese era
year:
$now = new DateTime(); //DateTime is a core PHP class as of version 5.2.0
$formatter = new IntlDateFormatter('ja_JP', IntlDateFormatter::FULL,
IntlDateFormatter::FULL, 'Asia/Tokyo', IntlDateFormatter::GREGORIAN);
echo 'It is now: "' . $formatter->format($now) . '" in Tokyo' .
"\n";
//above gives [It is now: "2011å¹´8æ19æ¥éææ¥
23æ32å27ç§JST" in Tokyo]
$formatter = new IntlDateFormatter('ja_JP@calendar=japanese', IntlDateFormatter::FULL,
IntlDateFormatter::FULL, 'Asia/Tokyo', IntlDateFormatter::TRADITIONAL);
echo 'It is now: "' . $formatter->format($now) . '" in Tokyo' .
"\n";
//above gives [It is now: "å¹³æ23å¹´8æ19æ¥éææ¥
23æ32å27ç§JST" in Tokyo]
----
Server IP: 109.169.40.147
Probable Submitter: 109.145.233.176
----
Manual Page -- http://www.php.net/manual/en/intldateformatter.create.php
Edit -- https://master.php.net/note/edit/105460
Del: integrated -- https://master.php.net/note/delete/105460/integrated
Del: useless -- https://master.php.net/note/delete/105460/useless
Del: bad code -- https://master.php.net/note/delete/105460/bad+code
Del: spam -- https://master.php.net/note/delete/105460/spam
Del: non-english -- https://master.php.net/note/delete/105460/non-english
Del: in docs -- https://master.php.net/note/delete/105460/in+docs
Del: other reasons-- https://master.php.net/note/delete/105460
Reject -- https://master.php.net/note/reject/105460
Search -- https://master.php.net/manage/user-notes.php