PHPackages                             hamidgh83/intldatetime - 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. hamidgh83/intldatetime

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

hamidgh83/intldatetime
======================

This class converts Gregorian date into Jalali format.

v1.0.1(7y ago)09MITPHPPHP ^7

Since Oct 5Pushed 5y ago1 watchersCompare

[ Source](https://github.com/hamidgh83/IntlDateTime)[ Packagist](https://packagist.org/packages/hamidgh83/intldatetime)[ Docs](https://github.com/hamidgh83/IntlDateTime)[ RSS](/packages/hamidgh83-intldatetime/feed)WikiDiscussions master Synced 2w ago

READMEChangelogDependenciesVersions (4)Used By (0)

### The package

[](#the-package)

[![Latest Stable Version](https://camo.githubusercontent.com/395fd7ad2fbfc1876934392650286e0d2f49b4e5e3763c89ed78bb11e27b48ca/68747470733a2f2f706f7365722e707567782e6f72672f68616d6964676838332f696e746c6461746574696d652f76)](//packagist.org/packages/hamidgh83/intldatetime)[![Total Downloads](https://camo.githubusercontent.com/60beb9aea1472cdd21e70fe7fe692780c9b29d1761b5e99057e840543bb43a58/68747470733a2f2f706f7365722e707567782e6f72672f68616d6964676838332f696e746c6461746574696d652f646f776e6c6f616473)](//packagist.org/packages/hamidgh83/intldatetime)[![License](https://camo.githubusercontent.com/72438b3edd352cd59435fbdef1fff2121aa3df5b8ed52549701fae5f2357f631/68747470733a2f2f706f7365722e707567782e6f72672f68616d6964676838332f696e746c6461746574696d652f6c6963656e7365)](//packagist.org/packages/hamidgh83/intldatetime)

### Overview

[](#overview)

This library can convert Gregorian dates into other calendars with supporting formatting output. It currently supports Jalali date but can be expandable for other calendars.

### Requirements

[](#requirements)

This library requires PHP 7.0 and above to be installed.

### Installation

[](#installation)

The library can be installed via composer:

```
$ composer require hamidgh83/intldatetime
```

### Usage

[](#usage)

Usage of this library is the same as PHP DateTime library.

#### Example 1:

[](#example-1)

```
$date = new \IntlDateTime\DateTime;

// You can change timezone
$date->setTimezone(new \DateTimeZone('Asia/Tehran'));

// Set an adapter to change calendar type
$date->setAdapter(\IntlDateTime\Adapters\AdapterTypeInterface::TYPE_JALALI);

// Set a Jalali date
$date->setDate(1395, 04, 19);

// Add one day to calculate further date
$interval = new DateInterval('P1D');
$date->add($interval);

echo $date->format("Y/m/d W");
```

#### Result

[](#result)

```
1395/04/20 یکشنبه

```

#### Example 2:

[](#example-2)

```
$date = new \IntlDateTime\DateTime('2017-08-01');

// Set an adapter to change calendar type
$date->setAdapter(\IntlDateTime\Adapters\AdapterTypeInterface::TYPE_JALALI);

echo $date->format("Y/m/d W");
```

#### Result

[](#result-1)

```
1396/05/10 سه شنبه

```

### Formatting outputs

[](#formatting-outputs)

IdentifierDescriptionExample*Day*------*d*Day of the month, 2 digits with leading zeros*01* to *31**D*A textual representation of a day, three letters*Mon* through *Sun**j*Day of the month without leading zeros*1* to *31**l*(lowercase 'L')A full textual representation of the day of the week*Sunday* through *Saturday**N*ISO-8601 numeric representation of the day of the week (added in PHP 5.1.0)*1* (for Monday) through *7* (for Sunday)*S*English ordinal suffix for the day of the month, 2 characters*st*, *nd*, *rd* or *th*. Works well with *j**w*Numeric representation of the day of the week0 (for Sunday) through *6* (for Saturday)*z*The day of the year (starting from 0)0 through *365**Week*------*W*ISO-8601 week number of year, weeks starting on MondayExample: *42* (the 42nd week in the year)*Month*------*F*A full textual representation of a month, such as January or March*January* through *December**m*Numeric representation of a month, with leading zeros*01* through *12**M*A short textual representation of a month, three letters*Jan* through *Dec**n*Numeric representation of a month, without leading zeros*1* through *12**t*Number of days in the given month*28* through *31**Year*------*L*Whether it's a leap year*1* if it is a leap year, 0 otherwise.*o*ISO-8601 week-numbering year. This has the same value as *Y*, except that if the ISO week number (*W*) belongs to the previous or next year, that year is used instead. (added in PHP 5.1.0)Examples: *1999*or *2003**Y*A full numeric representation of a year, 4 digitsExamples: *1999*or *2003**y*A two digit representation of a yearExamples: *99* or *03**Time*------*a*Lowercase Ante meridiem and Post meridiem*am* or *pm**A*Uppercase Ante meridiem and Post meridiem*AM* or *PM**B*Swatch Internet time*000* through *999**g*12-hour format of an hour without leading zeros*1* through *12**G*24-hour format of an hour without leading zeros0 through *23**h*12-hour format of an hour with leading zeros*01* through *12**H*24-hour format of an hour with leading zeros*00* through *23**i*Minutes with leading zeros*00* to *59**s*Seconds, with leading zeros*00* through *59**u*Microseconds (added in PHP 5.2.2). Note that date() will always generate *000000* since it takes an [integer](http://php.net/manual/en/language.types.integer.php) parameter, whereas [DateTime::format()](http://php.net/manual/en/datetime.format.php) does support microseconds if [DateTime](http://php.net/manual/en/class.datetime.php) was created with microseconds.Example: *654321**v*Milliseconds (added in PHP 7.0.0). Same note applies as for *u*.Example: *654**Timezone*------*e*Timezone identifier (added in PHP 5.1.0)Examples: *UTC*, *GMT*, *Atlantic/Azores**I* (capital i)Whether or not the date is in daylight saving time*1* if Daylight Saving Time, 0otherwise.*O*Difference to Greenwich time (GMT) in hoursExample: *+0200**P*Difference to Greenwich time (GMT) with colon between hours and minutes (added in PHP 5.1.3)Example: *+02:00**T*Timezone abbreviationExamples: *EST*, *MDT* ...*Z*Timezone offset in seconds. The offset for timezones west of UTC is always negative, and for those east of UTC is always positive.*-43200* through *50400**Full Date/Time*------*c*ISO 8601 date (added in PHP 5)2004-02-12T15:19:21+00:00*r*[» RFC 2822](http://www.faqs.org/rfcs/rfc2822) formatted dateExample: *Thu, 21 Dec 2000 16:01:07 +0200**U*Seconds since the Unix Epoch (January 1 1970 00:00:00 GMT)See also [time()](http://php.net/manual/en/function.time.php)

###  Health Score

27

—

LowBetter than 47% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity64

Established project with proven stability

 Bus Factor1

Top contributor holds 54.5% 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.

###  Release Activity

Cadence

Every ~0 days

Total

2

Last Release

2825d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/3264788?v=4)[Hamid](/maintainers/hamidgh83)[@hamidgh83](https://github.com/hamidgh83)

---

Top Contributors

[![hamidghorashi](https://avatars.githubusercontent.com/u/89512189?v=4)](https://github.com/hamidghorashi "hamidghorashi (6 commits)")[![hamidgh83](https://avatars.githubusercontent.com/u/3264788?v=4)](https://github.com/hamidgh83 "hamidgh83 (5 commits)")

---

Tags

dateJalaligregorianconvertor

### Embed Badge

![Health badge](/badges/hamidgh83-intldatetime/health.svg)

```
[![Health](https://phpackages.com/badges/hamidgh83-intldatetime/health.svg)](https://phpackages.com/packages/hamidgh83-intldatetime)
```

###  Alternatives

[morilog/jalali

This Package helps developers to easily work with Jalali (Shamsi or Iranian) dates in PHP applications, based on Jalali (Shamsi) DateTime class.

9231.2M49](/packages/morilog-jalali)[hekmatinasser/verta

This Package helps developers to work with Jalali Datetime class for Laravel Framework PHP

657541.4k28](/packages/hekmatinasser-verta)[fisharebest/ext-calendar

Implementation of the Arabic (Hijri), French, Gregorian, Jewish, Julian and Persian (Jalali) calendars. Also provides a replacement for the PHP ext/calendar extension.

31497.9k11](/packages/fisharebest-ext-calendar)[mohamedsabil83/laravel-hijrian

Hijri-Gregorian date converter for Laravel

1322.0k](/packages/mohamedsabil83-laravel-hijrian)

PHPackages © 2026

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