دعم التاريخ الهجري في yii
HijriDateTime extension is a convenient and complete solution for users who want to use Hijri date in their projects.
To convert Gregorian calendar to Hijri (Islamic) calendar . --- With version 1.0.1 you can translate it to your language.
-- It support ar, en, fr languages
This extensions is 100% compatible with "Umm al-Qura" formal calendar in Saudi Arabia and the Muslim world.
Requirements ¶
Yii 1.1 or above, PHP 5
Install ¶
- Extract to extensions directory
- copy the messages folder to you protected folder
- Add as component to main config
// To sopport I18N translation ->> folder messages/ar
'language' => 'ar', // for now ar, en, fr languages are provided ' thanks to abennouna
// application components
'components' => array(
/*---- other components*/
// Hijri date
'hdate' => array(
'class' => 'ext.hdate.HijriDateTime',
),
Usage ¶
see Date Function in PHP for the full date format
Yii::app()->hdate->date("H:i A l, d F Y",time()) // formatting is like date function
// will return الجمعة, 08 ربيع الأول 1432 06:10 صباحاً
To get an array of month, day, year in Hijri
Yii::app()->hdate->GeToHijr(20, 02, 1976)
// will return Array Hijri date[int month, int day, int year]
To parse about any English textual datetime description into a Hijri format if no format the date returned will be Hijri d-m-Y
Yii::app()->hdate->strToHijri("19 June 2012")
// will return a Date in Hijri d-m-Y if not formated
//-------- Or -----------
Yii::app()->hdate->strToHijri("19 June 2012", "l, d F Y H:i A")
// will return a Date in Hijri as formated like الجمعة, 08 ربيع الأول 1432 06:10 صباحاً
Changelog ¶
v 1.0.1 adding the translation files and improving the ext. (thanks to abennouna)
Good work, maybe localization needed
Thank you for this extension. It will sure be very handful.
I have two observations:
محرّم, صفر, ربيع الأول, ربيع الثاني, جمادى الأولى, جمادى الثانية
رجب, شعبان, رمضان, شوّال, ذو القعدة, ذو الحجة
Moharram, Safar, Rabiî I, Rabiî II, Joumada I, Joumada II,
Rajab, Chaâbane, Ramadan, Chaoual, Dou Al Qiîda, Dou Al Hijja
Thank you abennouna
I have added the translations files to the ext.
Thank you so much for the great observations.
Kind regards,
Abdulrhman A.
Thanks
Thanks for the plugin...
Thanks
تسلم على مجهودك
How to display the database table date field value using hijridatetime extension
Hello I like this extension, but I have a problem that how to display the database table field value using this extension in arabic format. actually I am currently working on a project in which I want the post creation date in arabic format.
If you have any questions, please ask in the forum instead.
Signup or Login in order to comment.