PHPackages                             kfirba/hebdate - 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. kfirba/hebdate

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

kfirba/hebdate
==============

A library to convert jewish dates to gregorian dates and vice versa

v1.0(6y ago)630.9k↓15.9%1[2 issues](https://github.com/kfirba/hebdate/issues)MITPHPPHP &gt;=7.2

Since Jun 19Pushed 6y ago3 watchersCompare

[ Source](https://github.com/kfirba/hebdate)[ Packagist](https://packagist.org/packages/kfirba/hebdate)[ RSS](/packages/kfirba-hebdate/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (1)Dependencies (2)Versions (4)Used By (0)

Hebdate
=======

[](#hebdate)

[![Version](https://camo.githubusercontent.com/c8055b2923626a3f062fda1cc632b05e1a218b4a70d4d285c95c9d5e0378f0dd/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6b66697262612f686562646174652e737667)](https://camo.githubusercontent.com/c8055b2923626a3f062fda1cc632b05e1a218b4a70d4d285c95c9d5e0378f0dd/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6b66697262612f686562646174652e737667)[![Status](https://camo.githubusercontent.com/53efc25c61b2d2a439b6f0f4f73f66335427727bbd31502eb2300e9f157541b4/68747470733a2f2f6170692e7472617669732d63692e6f72672f6b66697262612f486562646174652e737667)](https://camo.githubusercontent.com/53efc25c61b2d2a439b6f0f4f73f66335427727bbd31502eb2300e9f157541b4/68747470733a2f2f6170692e7472617669732d63692e6f72672f6b66697262612f486562646174652e737667)

Hebdate is a simple library that lets you easily convert gregorian dates to jewish dates, and vice versa, using several formats.

Installation
------------

[](#installation)

Install the package via composer:

```
composer require kfirba/hebdate

```

Basic Usage
-----------

[](#basic-usage)

Let's convert some dates:

```
// Note that we should pass the date as dd/mm/yyyy format:
GregorianDate::toJewish([5, 6, 2016])->convert();
// -> 28 9 5776
GregorianDate::toJewish('05/06/2016')->convert();
// -> 28 9 5776
GregorianDate::toJewish(Carbon::createFromDate(2016, 6, 5))->convert();
// -> 28 9 5776
GregorianDate::toJewish(new DateTime('2016-06-05'))->convert();
// -> 28 9 5776
```

Naturally, we can use it vice versa:

```
GregorianDate::fromJewish('28 9 5776')->convert();
// -> 05/06/2016
GregorianDate::fromJewish('28 Iyar 5776')->convert();
// -> 05/06/2016
GregorianDate::fromJewish('כח אייר התשעו')->convert();
// -> 05/06/2016
GregorianDate::fromJewish('כח׳ אייר התשע״ו')->convert();
// -> 05/06/2016
```

Actually, behind the scenes we are using two classes which you can choose whichever you want to use, the `GregorianDate` class and the `JewishDate` class.

By calling `GregorianDate::fromJewish()`, you actually new up a `JewishDate` instance. So it's identical to:

```
JewishDate::toGregorian('28 9 5776')->convert();
// -> 05/06/2016
```

As you may have guessed, you can also call:

```
JewishDate::fromGregorian('05/06/2016')->convert();
// -> 28 9 5776
```

Input
-----

[](#input)

As we have seen before, the classes are accepting different input formats:

- #### `GregorianDate::toJewish(INPUT_TYPE)`:

    [](#gregoriandatetojewishinput_type)

    1. **Array** - A plain PHP array that represents the date in \[dd, mm, yyyy\] format.
    2. **String** - A string of a gregorian date in the format of mm/dd/yyyy. The delimiter may be a slash(/), a dot(.) or a dash(-). For example: 05-06-2016.
    3. [**Carbon Object**](https://github.com/briannesbitt/Carbon) - Any Carbon object.
    4. [**DateTime Object**](http://php.net/manual/en/class.datetime.php) - Any DateTime object.
- #### `JewishDate::fromGregorian(INPUT_TYPE)`:

    [](#jewishdatefromgregorianinput_type)

    1. Has the same options as `GregorianDate::toJewish(INPUT_TYPE)` as it's just an alias.
- #### `JewishDate::toGregorian(INPUT_TYPE)`:

    [](#jewishdatetogregorianinput_type)

    1. **Array** - an array that contains a hebrew date in \[dd, mm, yyyy\] format.
    2. **Numeric String** - A numeric string in "dd mm yyyy" format (note that the delimiter has to be a space). For example, 28 9 5776.
    3. **English month numeric string** - A numeric string with english month name. For example, 28 Iyar 5776.
    4. **Full hebrew date string** - A full hebrew string without any punctuation. For example, כח אייר התשעו.
    5. **Full hebrew date string with punctuation** - A full hebrew string with punctuation. For example, כח׳ אייר התשע״ו.
- #### `GregorianDate::fromJewish(INPUT_TYPE)`:

    [](#gregoriandatefromjewishinput_type)

    1. Has the same options as `JewishDate::toGregorian(INPUT_TYPE)` as it's just an alias.

Output
------

[](#output)

We can also specify which output format we want for the date. To do so, we just need to chain the `format()` method and supply it with a format.

**Note that the format constants are under `Kfirba\Formats\Format` class.**

#### Jewish Date Formats:

[](#jewish-date-formats)

```
GregorianDate::toJewish('05/06/2016')->format(Format::NUMERIC)->convert();
// The default format -> 28 9 5776
GregorianDate::toJewish('05/06/2016')->format(Format::ENGLISH_MONTH)->convert();
// -> 28 Iyar 5776
GregorianDate::toJewish('05/06/2016')->format(Format::HEBREW_FULL)->convert();
// -> כח אייר התשעו
GregorianDate::toJewish('05/06/2016')->format(Format::PRESENTABLE_HEBREW_FULL)->convert();
// -> כח׳ אייר התשע״ו

// These formats also apply when using the JewishDate::fromGregorian() constructor:

JewishDate::fromGregorian('05/06/2016')->format(Format::NUMERIC)->convert();
// The default format -> 28 9 5776
JewishDate::fromGregorian('05/06/2016')->format(Format::ENGLISH_MONTH)->convert();
// -> 28 Iyar 5776
JewishDate::fromGregorian('05/06/2016')->format(Format::HEBREW_FULL)->convert();
// -> כח אייר התשעו
JewishDate::fromGregorian('05/06/2016')->format(Format::PRESENTABLE_HEBREW_FULL)->convert();
// -> כח׳ אייר התשע״ו
```

#### Gregorian Date Formats:

[](#gregorian-date-formats)

```
JewishDate::toGregorian('28 9 5776')->format(Format::NUMERIC)->convert();
// The default format -> 05/06/2016
JewishDate::toGregorian('28 9 5776')->format(Format::CARBON)->convert();
// -> Carbon Object {}
JewishDate::toGregorian('28 9 5776')->format(Format::DATETIME)->convert();
// -> DateTime Object {}

// These formats also apply when suing the GregorianDate::fromJewish() constructor:

GregorianDate::fromJewish('28 9 5776')->format(Format::NUMERIC)->convert();
// The default format -> 05/06/2016
GregorianDate::fromJewish('28 9 5776')->format(Format::CARBON)->convert();
// -> Carbon Object {}
GregorianDate::fromJewish('28 9 5776')->format(Format::DATETIME)->convert();
// -> DateTime Object {}
```

Extras
------

[](#extras)

The `convert()` method accepts a `$delimiter` argument. When converting to Jewish dates it defaults to a space (" ") and when converting to Gregorian date it defaults to a slash (/).

The library also registers 2 global functions:

1. `utf8_str_split($str = '', $len = 0)` which acts the same as PHP's `str_split` function but works on UTF8 strings.
2. `isJewishLeapYear($year)` which determines whether the given year is a leap year. Note that the year has to be numeric and greater than 5000.

License
-------

[](#license)

The Hebdate package is open-source project licensed under the MIT license.

###  Health Score

33

—

LowBetter than 75% of packages

Maintenance13

Infrequent updates — may be unmaintained

Popularity35

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity60

Established project with proven stability

 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.

###  Release Activity

Cadence

Every ~607 days

Total

3

Last Release

2405d ago

Major Versions

v0.2 → v1.02019-10-17

PHP version history (2 changes)v0.1PHP &gt;=5.5.0

v1.0PHP &gt;=7.2

### Community

Maintainers

![](https://www.gravatar.com/avatar/00b97262a98fa4f5375e21a881c2b43493f4fd60067cea73669365fe60da4c79?d=identicon)[kfirba](/maintainers/kfirba)

---

Top Contributors

[![kfirba](https://avatars.githubusercontent.com/u/8510486?v=4)](https://github.com/kfirba "kfirba (40 commits)")

---

Tags

datejewishhebrewconvert dategregorian to hebrewhebrew to gregorian

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/kfirba-hebdate/health.svg)

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

###  Alternatives

[rlanvin/php-rrule

Lightweight and fast recurrence rules for PHP (RFC 5545)

69810.6M39](/packages/rlanvin-php-rrule)[knplabs/knp-time-bundle

Making your dates and durations look sensible and descriptive

6308.9M39](/packages/knplabs-knp-time-bundle)[league/period

Time range API for PHP

7335.4M21](/packages/league-period)[morilog/jalali

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

9201.2M45](/packages/morilog-jalali)[brick/date-time

Date and time library

3623.3M61](/packages/brick-date-time)[aeon-php/calendar

PHP type safe, immutable calendar library

2079.7M16](/packages/aeon-php-calendar)

PHPackages © 2026

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