2017 © Pedro Peláez
 

library jalaali-php

PHP functions for converting Jalaali and Gregorian calendar systems to each other.

image

jalaali/jalaali-php

PHP functions for converting Jalaali and Gregorian calendar systems to each other.

  • Thursday, October 22, 2015
  • by novid
  • Repository
  • 1 Watchers
  • 9 Stars
  • 2 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

Jalaali PHP

PHP implementation of jalaali.js which contains functions for converting Jalaali and Gregorian calendar systems to each other., (*1)

Jalaali calendar system has different names such as:, (*2)

  • Jalaali
  • Khayyami
  • Khorshidi
  • Persian
  • Shamsi

The base algorithm is a derived work of Omar Khayyam, who completed the calendar system more than 900 years ago., (*3)

About

Jalaali calendar is a solar calendar that was used in Persia, variants of which today are still in use in Iran as well as Afghanistan. Read more or see Calendar Converter., (*4)

Calendar conversion is based on the algorithm provided by Kazimierz M. Borkowski and has a very good performance., (*5)

Install

composer require jalaali/jalaali-php, (*6)

API

Base Jalaali class is defined with 10 static methods inside Jalaali namespace, so there's no need for instantiation. For example, to convert Gregorian date to Jalaali use this code:, (*7)

// PHP 3.0.x date to Jalaali :)
\Jalaali\Jalaali::toJalaali(2000, 10, 20)

There is a complete documentation page for this project on docs/api folder but the list of methods is as follows:, (*8)

toJalaali($gy, $gm, $gd) : Converts a Gregorian date to Jalaali, (*9)

toGregorian($jy, $jm, $jd) : Converts a Jalaali date to Gregorian, (*10)

isValidJalaaliDate($jy, $jm, $jd) : Checks whether a Jalaali date is valid or not, (*11)

isLeapJalaaliYear($jy) : Checks whether this is a leap year or not, (*12)

jalaaliMonthLength($jy, $jm) : Number of days in a given month in Jalaali year, (*13)

jalaaliCalendar($jy) : Base Algorithm, (*14)

j2d($jy, $jm, $jd) : Converts a date of the Jalaali calendar to the Julian Day Number, (*15)

d2j($jdn) : Converts the Julian Day Number to a date in the Jalaali calendar, (*16)

g2d($gy, $gm, $gd) : Calculates the Julian Day number from Gregorian or Julian calendar dates, (*17)

d2g($jdn) : Calculates Gregorian and Julian calendar dates from the Julian Day number, (*18)

The Versions

22/10 2015

dev-master

9999999-dev https://github.com/jalaali/jalaali-php

PHP functions for converting Jalaali and Gregorian calendar systems to each other.

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

gregorian julian jalaali