note 103364 deleted from intldateformatter.create by danbrown

From: Date: Mon, 11 Apr 2011 15:33:58 +0000
Subject: note 103364 deleted from intldateformatter.create by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-178696@lists.php.net to get a copy of this message
Note Submitter: arash at NOSPAM dot php dot net ---- 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: ١٣٨٩ شوال ٢٣ الخميس ٠٤:٠٠:٠٠

« previous php.notes (#178696) next »