hijrishamsidatetime Hijri Shamsi (Solar Hijri) date time extension

  1. Requirements
  2. Install
  3. Usage

HijriShamsiDateTime extension is a convenient and complete solution for users who want to use Hijri Shamsi date in their projects.

The modern Iranian calendar (Solar Hijri calendar (SH)) is now the official calendar in Iran and Afghanistan. It begins on the vernal equinox as determined by astronomical calculations for the Iran Standard Time meridian (52.5°E or GMT+3.5h). This determination of starting moment is more accurate than the Gregorian calendar as far as predicting the date of the vernal equinox is concerned because it uses astronomical calculation rather than mathematical rules.

Requirements

Yii 1.1 or above, PHP 5

Install

  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/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',
        ),

Usage

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

3 0
5 followers
707 downloads
Yii Version: 1.1
License: GPL-3.0
Category: Date and Time
Developed by: Michel Kogan
Created on: Jul 11, 2012
Last updated: 11 years ago

Downloads

show all

Related Extensions