PHPackages                             sajjadrad/jalali - 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. [Localization &amp; i18n](/categories/localization)
4. /
5. sajjadrad/jalali

ActiveLibrary[Localization &amp; i18n](/categories/localization)

sajjadrad/jalali
================

This Package helps developers to easily work with Jalali (Shamsi or Iranian) dates in Laravel 4 applications, based on Jalali (Shamsi) DateTime class. This Package is based on a Laravel 3 bundle \[sallar/laravel-jdate\](https://github.com/sallar/laravel-jdate) by \[Sallar Kaboli\](http://sallar.me).This package converted from Laravel 3 bundle to Laravel 4 package by \[Milad Rey\](https://github.com/miladr/jalali).Older version of this library was unable to make a renge of numbers between two years in jalali with latin style.

2173PHP

Since Sep 26Pushed 11y ago1 watchersCompare

[ Source](https://github.com/sajjadrad/jalali)[ Packagist](https://packagist.org/packages/sajjadrad/jalali)[ RSS](/packages/sajjadrad-jalali/feed)WikiDiscussions master Synced today

READMEChangelogDependenciesVersions (1)Used By (0)

sajjadrad/jalali
================

[](#sajjadradjalali)

This Package helps developers to easily work with Jalali (Shamsi or Iranian) dates in Laravel 4 applications, based on Jalali (Shamsi) DateTime class. This Package is based on a Laravel 3 bundle [sallar/laravel-jdate](https://github.com/sallar/laravel-jdate) by [Sallar Kaboli](http://sallar.me).This package converted from Laravel 3 bundle to Laravel 4 package by [Milad Rey](https://github.com/miladr/jalali).Older version of this library was unable to make a renge of numbers between two years in jalali with latin style.

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

[](#installation)

In the `require` key of `composer.json` file add the following

```
    "sajjadrad/jalali": "dev-master"
```

Run the Composer update comand

```
$ composer update

```

In your `config/app.php` add `'Sajjadrad\Jalali\JalaliServiceProvider'` to the end of the `$providers` array

```
    'providers' => array(

        'Illuminate\Foundation\Providers\ArtisanServiceProvider',
        'Illuminate\Auth\AuthServiceProvider',
        ...
        'Sajjadrad\Jalali\JalaliServiceProvider',

    ),
```

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

[](#basic-usage)

Examples
--------

[](#examples)

Some Examples (based on examples provided by Sallar)

```
// default timestamp is now
$date = jDate::forge();

// pass timestamps
$date = jDate::forge(1333857600);

// pass strings to make timestamps
$date = jDate::forge('last sunday');

// get the timestamp
$date = jDate::forge('last sunday')->time(); // 1333857600

// format the timestamp
$date = jDate::forge('last sunday')->format('%B %d، %Y'); // دی 02، 1391

// get a predefined format
$date = jDate::forge('last sunday')->format('datetime'); // 1391-10-02 00:00:00
$date = jDate::forge('last sunday')->format('date'); // 1391-10-02
$date = jDate::forge('last sunday')->format('time'); // 00:00:00

// amend the timestamp value, relative to existing value
$date = jDate::forge('2012-10-12')->reforge('+ 3 days')->format('date'); // 1391-07-24

// get relative 'ago' format
$date = jDate::forge('now - 10 minutes')->ago() // ۱۰ دقیقه پیش

// Format function return number in persian style by default.You can convert it to latin style by init convert flag in argument.
$date = jDate::forge(time())->format('Y',true);
```

Formatting
----------

[](#formatting)

For help in building your formats, checkout the [PHP strftime() docs](http://php.net/manual/en/function.strftime.php).

Notes
-----

[](#notes)

The class relies on `strtotime()` to make sense of your strings, and `strftime()` to make the format changes. Just always check the `time()` output to see if you get false timestamps... which means the class couldn't understand what you were telling it.

License
-------

[](#license)

- This bundle is created based on [Laravel-Date](https://github.com/swt83/laravel-date) by [Scott Travis](https://github.com/swt83) (MIT Licensed).
- [Jalali (Shamsi) DateTime](https://github.com/sallar/jDateTime) class included in the package is created by [Sallar Kaboli](http://sallar.me) and is released under the MIT License.
- Older version was created by [Milad Rey](http://milad.io) and is released under the MIT License. \_ This version is released under MIT license too.

###  Health Score

23

—

LowBetter than 26% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity13

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 90.9% 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/f22c5973d6ed73cc19b4ce76671fc219484a9be0605f388c3d69f5d1f7e1baa9?d=identicon)[sajjadrad](/maintainers/sajjadrad)

---

Top Contributors

[![miladr](https://avatars.githubusercontent.com/u/1630638?v=4)](https://github.com/miladr "miladr (20 commits)")[![sajjadrad](https://avatars.githubusercontent.com/u/1608837?v=4)](https://github.com/sajjadrad "sajjadrad (2 commits)")

### Embed Badge

![Health badge](/badges/sajjadrad-jalali/health.svg)

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

###  Alternatives

[smmoosavi/php-gettext

Wrapper for php-gettext by danilo segan. This library provides PHP functions to read MO files even when gettext is not compiled in or when appropriate locale is not present on the system.

1927.0k1](/packages/smmoosavi-php-gettext)

PHPackages © 2026

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