HijriShamsiDateTime extension is a convenient and complete solution for users who want to use Hijri Shamsi date in their projects.
Yii 1.1 or above, PHP 5
// To sopport I18N translation ->> folder messages/fa 'language' => 'fa', // for now fa, en languages are provided // application components 'components' => array( /*---- other components*/ // Hijri Shamsi date 'shamsidate' => array( 'class' => 'ext.shamsidate.HijriShamsiDateTime', ),
see Date Function in PHP for the full date format
Yii::app()->shamsidate->date("H:i A l, d F Y",time()) // formatting is like date function //will return 20:15 بعد از ظهر دو شنبه, 21 تیر 1391
To get an array of month, day, year in Hijri Shamsi
Yii::app()->shamsidate->GregorianToHijriShamsi(20, 02, 1976); // will return Hijri Shamsi date[int month, int day, int year]
To parse about any English textual datetime description into a Hijri Shamsi format if no format the date returned will be Hijri Shamsi d-m-Y
Yii::app()->shamsidate->strToHijriShamsi("19 June 2012") // will return a Date in Hijri Shamsi d-m-Y if not formatted //-------- Or ----------- Yii::app()->shamsidate->strToHijriShamsi("11 July 2012", "l, d F Y") // will return a Date in Hijri Shamsi as formatted like دو شنبه, 21 تیر 1391
Be the first person to leave a comment
Please login to leave your comment.