note 128187 added to intldateformatter.create
| From: | info at mobger dot de | Date: | Sat, 04 Feb 2023 07:50:25 +0000 |
| Subject: | note 128187 added to intldateformatter.create | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-220143@lists.php.net to get a copy of this message | ||
The $locale can although contain the information about the calendar
<?php
//...
$traditionalFormatter = new IntlDateFormatter(
$locale.'@calendar='.$calendar,
IntlDateFormatter::SHORT,
IntlDateFormatter::SHORT,
'Europe/Berlin',
IntlDateFormatter::TRADITIONAL,
'yyyy/MM/dd HH:mm:ss' // ICU-datetime-format
);
//..
?>
To get the allowed values for $calendar, use the following code:
<?php
$bundle=new ResourceBundle('','ICUDATA');
$cnames=[];
$calendars=$bundle->get('calendar');
foreach($calendars as $n=>$v){
$cnames[]=$n;
}
echo (print_r($cnames,true));
?>
The result is:
Array
(
[0] => buddhist
[1] => chinese
[2] => coptic
[3] => dangi
[4] => default
[5] => ethiopic
[6] => ethiopic-amete-alem
[7] => gregorian
[8] => hebrew
[9] => indian
[10] => islamic
[11] => islamic-civil
[12] => japanese
[13] => persian
[14] => roc
)
----
Server IP: 45.112.84.4
Probable Submitter: 45.91.158.213 (proxied: 2003:e4:970f:cce4:5cc8:465e:60e7:607e)
----
Manual Page -- https://php.net/manual/en/intldateformatter.create.php
Edit -- https://main.php.net/note/edit/128187
Del: integrated -- https://main.php.net/note/delete/128187/integrated
Del: useless -- https://main.php.net/note/delete/128187/useless
Del: bad code -- https://main.php.net/note/delete/128187/bad+code
Del: spam -- https://main.php.net/note/delete/128187/spam
Del: non-english -- https://main.php.net/note/delete/128187/non-english
Del: in docs -- https://main.php.net/note/delete/128187/in+docs
Del: other reasons-- https://main.php.net/note/delete/128187
Reject -- https://main.php.net/note/reject/128187
Search -- https://main.php.net/manage/user-notes.php