note 103364 added to intldateformatter.create

From: Date: Sun, 10 Apr 2011 16:06:59 +0000
Subject: note 103364 added to intldateformatter.create
Groups: php.notes 
Request: Send a blank email to php-notes+get-178665@lists.php.net to get a copy of this message
It seems that this page lacks documentation and examples, first it worth to know these: First parameter is local, you can find the list of all possible locales here: http://goo.gl/skfwB if you want to use a calendar other than Georgian calendar you can define it in the first parameter, for example you can use this to get the dates converted to Persian date "fa_IR@Persian", possible calendars are: Islamic, Persian, Hebrew, Chinese, and Japanese Note that you should set the 5th parameter (calendar) to "IntlDateFormatter::TRADITIONAL" if you want to use one of above calendars. 4th parameter is timezone which you can find the list of possible parameters here: http://en.wikipedia.org/wiki/List_of_tz_database_time_zones Here are some examples: $fmt = new IntlDateFormatter( "FA_IR@calendar=Persian", IntlDateFormatter::FULL, IntlDateFormatter::FULL, 'Asia/Tehran', IntlDateFormatter::TRADITIONAL, "EEEE d Y MMMM" ); echo $fmt->format(0); OUTPUT: پنجشنبه ۱۱ ۱۳۴۸ دی $fmt = new IntlDateFormatter( "ja_JP@calendar=Japanese", IntlDateFormatter::FULL, IntlDateFormatter::FULL, 'Asia/Tokyo', IntlDateFormatter::TRADITIONAL ); echo $fmt->format(0); OUTPUT: 昭和45年1月1日木曜日 9時00分00秒 日本標準時 $fmt = new IntlDateFormatter( "ar_AE@calendar=Islamic", IntlDateFormatter::FULL, IntlDateFormatter::FULL, 'Asia/Dubai', IntlDateFormatter::TRADITIONAL, "Y MMMM d EEEE HH:mm:SS" ); echo $fmt->format(0); OUTPUT: ١٣٨٩ شوال ٢٣ الخميس ٠٤:٠٠:٠٠ ---- Server IP: 79.132.192.3 Probable Submitter: 92.50.9.172 ---- Manual Page -- http://www.php.net/manual/en/intldateformatter.create.php Edit -- https://master.php.net/note/edit/103364 Del: integrated -- https://master.php.net/note/delete/103364/integrated Del: useless -- https://master.php.net/note/delete/103364/useless Del: bad code -- https://master.php.net/note/delete/103364/bad+code Del: spam -- https://master.php.net/note/delete/103364/spam Del: non-english -- https://master.php.net/note/delete/103364/non-english Del: in docs -- https://master.php.net/note/delete/103364/in+docs Del: other reasons-- https://master.php.net/note/delete/103364 Reject -- https://master.php.net/note/reject/103364 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#178665) next »