jalaali/jalaali-php 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

jalaali/jalaali-php

Composer 安装命令:

composer require jalaali/jalaali-php

包简介

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

README 文档

README

PHP implementation of jalaali.js which contains functions for converting Jalaali and Gregorian calendar systems to each other.

Jalaali calendar system has different names such as:

  • 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.

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.

Calendar conversion is based on the algorithm provided by Kazimierz M. Borkowski and has a very good performance.

Install

composer require jalaali/jalaali-php

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:

// 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:

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

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

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

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

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

jalaaliCalendar($jy) : Base Algorithm

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

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

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

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

统计信息

  • 总下载量: 23
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 12
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 12
  • Watchers: 2
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2015-10-12