Yii 1.1: hijridatetime

Hijri Date Time Extention, التاريخ الهجري

دعم التاريخ الهجري في 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.


Yii 1.1 or above, PHP 5


  1. Extract to extensions directory
  2. copy the messages folder to you protected folder
  3. 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',


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 صباحاً


v 1.0.1 adding the translation files and improving the ext. (thanks to abennouna)

Total 5 comments

#17405 report it
InsafiaN at 2014/06/05 10:56am
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.

#16481 report it
Mohamed Bdwey at 2014/02/27 06:36am

تسلم على مجهودك

#8805 report it
pckabeer at 2012/06/28 12:34am

Thanks for the plugin...

#8002 report it
Abdulrhman A at 2012/05/02 11:48am
Thank you abennouna

I have added the translations files to the ext. Thank you so much for the great observations.

Kind regards, Abdulrhman A.

#8001 report it
bennouna at 2012/05/02 10:27am
Good work, maybe localization needed

Thank you for this extension. It will sure be very handful.

I have two observations:

  • The comma "," in full Hijri dates isn't appropriate, it should be its Arabic equivalent "،"
  • Is it possible to have an external localization file? Maybe you know it already, but for instance in Morocco, here are the month names:
    • In Arabic محرّم, صفر, ربيع الأول, ربيع الثاني, جمادى الأولى, جمادى الثانية رجب, شعبان, رمضان, شوّال, ذو القعدة, ذو الحجة
    • In French transliteration: Moharram, Safar, Rabiî I, Rabiî II, Joumada I, Joumada II, Rajab, Chaâbane, Ramadan, Chaoual, Dou Al Qiîda, Dou Al Hijja
    • And I think other Arabic-speaking countries or Islamic countries may have their own transliteration.

Leave a comment

Please to leave your comment.

Create extension