PHPackages                             yashar-rashedi/jalali-date - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. yashar-rashedi/jalali-date

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

yashar-rashedi/jalali-date
==========================

Jalali calendar conversion to gregorian and vise versa.

0841PHP

Since Jan 29Pushed 1y ago1 watchersCompare

[ Source](https://github.com/yasharrashedi/jalali-date)[ Packagist](https://packagist.org/packages/yashar-rashedi/jalali-date)[ RSS](/packages/yashar-rashedi-jalali-date/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

HOW-TO GUIDE
============

[](#how-to-guide)

### Convert Gregorian calendar date to Jalali

[](#convert-gregorian-calendar-date-to-jalali)

```
$date = new Jalali();
echo $date->setGregorianDate(new \DateTime())->getJalali()->format('Y/m/d');

```

As you may have noticed, you can use [PHP's standard date format characters](http://php.net/manual/en/function.date.php) to format your Jalali date. Isn't that cool?

### Convert Jalali calendar date to Gregorian

[](#convert-jalali-calendar-date-to-gregorian)

```
$date = new Jalali(1392, 6, 6);
echo $date->getGregorian()->format('Y/m/d');

```

### Formatting the converted date

[](#formatting-the-converted-date)

Let's say you want to output the Jalali converted date to something like "پنج شنبه، ۸ شهریور ۱۳۹۲" You can achieve this by

```
$date = new Jalali();
echo $date->setGregorianDate(new \DateTime())->getJalali()->format('w, d F Y');

```

This looks pretty much like the above code. All I have done is that I have provided a different format string `w, d F Y`

### Adding units of date/time to the Jalali calendar date

[](#adding-units-of-datetime-to-the-jalali-calendar-date)

To add a number of years/months/days/hours/minutes/seconds to the converted Jalali date you can use the `add()` method.

This method accepts two arguments. The first one is the number of units to add to the date and the second one is the date/time designator character.

Let's say you want to add 7 days to the current date.

```
$date = new Jalali(1392, 6, 6);
echo $date->add(7, 'D')->format('Y/m/d');

```

You could also do it like this:

```
$date = new Jalali(1392, 6, 6);
echo $date->add(1, 'W')->format('Y/m/d');

```

Again if you've noticed, [PHP's standard DateInterval characters](http://www.php.net/manual/en/dateinterval.construct.php) are used to add units of date/time to the Jalali date.

You can also use *negative values* for the unit being added to the Jalali date to subtract the amount of date/time from the Jalali date if you need to navigate backward in time.

### Convert TIMESTAMP to a Jalali calendar date

[](#convert-timestamp-to-a-jalali-calendar-date)

```
$date = new Jalali();
echo $date->setTimestamp(time())->getJalali()->format('Y/m/d');

```

It was that simple. All you need to do to convert a timestamp.

###  Health Score

18

—

LowBetter than 8% of packages

Maintenance33

Infrequent updates — may be unmaintained

Popularity14

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity16

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://www.gravatar.com/avatar/5fe5511845db336fd311077cc519cee2953c5e31d02f9a51a67b0bcdc224f364?d=identicon)[yasharrashedi](/maintainers/yasharrashedi)

---

Top Contributors

[![yashar2004](https://avatars.githubusercontent.com/u/51485450?v=4)](https://github.com/yashar2004 "yashar2004 (3 commits)")

### Embed Badge

![Health badge](/badges/yashar-rashedi-jalali-date/health.svg)

```
[![Health](https://phpackages.com/badges/yashar-rashedi-jalali-date/health.svg)](https://phpackages.com/packages/yashar-rashedi-jalali-date)
```

###  Alternatives

[makeabledk/laravel-factory-enhanced

180118.6k4](/packages/makeabledk-laravel-factory-enhanced)[lukeraymonddowning/self-healing-urls

16715.9k](/packages/lukeraymonddowning-self-healing-urls)[yii2mod/yii2-sweet-alert

Alert widget based on SweetAlert extension {@link http://tristanedwards.me/sweetalert)

43154.0k2](/packages/yii2mod-yii2-sweet-alert)[heureka/inflection

Czech inflection library

6163.9k](/packages/heureka-inflection)[ptachoire/php-dmtx

Datamatrix r/w based on libdmtx &lt;http://www.libdmtx.org/&gt;

1868.3k](/packages/ptachoire-php-dmtx)[cybercog/yii2-google-analytics

Google Analytics Widget for the Yii2 framework

1677.1k2](/packages/cybercog-yii2-google-analytics)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
