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 4w ago

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 27% 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

[symfony/translation

Provides tools to internationalize your application

6.6k836.5M2.0k](/packages/symfony-translation)[nesbot/carbon

An API extension for DateTime that supports 281 different languages.

169661.4M4.8k](/packages/nesbot-carbon)[joedixon/laravel-translation

A tool for managing all of your Laravel translations

717911.4k11](/packages/joedixon-laravel-translation)[illuminate/translation

The Illuminate Translation package.

6936.4M491](/packages/illuminate-translation)[lajax/yii2-translate-manager

Translation management extension for Yii 2

227578.8k13](/packages/lajax-yii2-translate-manager)[larswiegers/laravel-translations-checker

Make sure your laravel translations are checked and are included in all languages.

256423.2k2](/packages/larswiegers-laravel-translations-checker)

PHPackages © 2026

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