Download the PHP package jobmetric/multi-calendar without Composer
On this page you can find all versions of the php package jobmetric/multi-calendar. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download jobmetric/multi-calendar
More information about jobmetric/multi-calendar
Files in jobmetric/multi-calendar
Package multi-calendar
Short Description Multi-Calendar is a PHP library for converting dates between Gregorian, Jalali, Hijri, Hebrew, Buddhist, Coptic, Ethiopian, and Chinese calendars, with simple API and support for array or formatted string outputs.
License MIT
Homepage https://doc.jobmetric.net/package/multi-calendar
Informations about the package multi-calendar
Multi Calendar for PHP
Multi-Calendar is a PHP library for converting dates between multiple calendar systems, including Gregorian, Jalali (Persian), Hijri (Islamic), Hebrew, Buddhist, Coptic, Ethiopian, and Chinese. It provides an easy-to-use API with support for both array and formatted string outputs, making date conversions reliable and consistent across different calendar types.
Install via composer
Run the following command to pull in the latest version:
Documentation
Basic Usage
Supported Calendars
This library supports the following calendar systems, each with its own converter class. You can instantiate these classes and use their methods to convert dates between the Gregorian calendar and the respective calendar system.
| Calendar Key | Class Name | Description |
|---|---|---|
gregorian |
GregorianConverter (default) | The standard calendar used worldwide. |
jalali (Persian) |
JalaliConverter | The Iranian calendar, also known as the Solar Hijri calendar. |
hijri (Islamic) |
HijriConverter | The lunar calendar used in the Islamic world. |
hebrew |
HebrewConverter | The calendar used in Jewish culture. |
buddhist |
BuddhistConverter | The calendar used in many Buddhist countries. |
coptic |
CopticConverter | The calendar used in the Coptic Orthodox Church. |
ethiopian |
EthiopianConverter | The calendar used in Ethiopia. |
chinese |
ChineseConverter | The traditional Chinese calendar. |
Using the Factory
You can also use the CalendarConverterFactory to create converters dynamically based on the calendar key:
Number Transliteration
You can convert numbers between English, Persian, and Arabic numeral systems:
Output Format
Array output: default when $mod (separator) is empty
Example: [2025, 8, 13]
String output: set $mod to a separator (/, -, .)
Example: "2025/08/13"
Example Conversion Table for 2025-08-13 (Gregorian)
| Calendar | Date |
|---|---|
| Gregorian | 2025-08-13 |
| Jalali | 1404-05-22 |
| Hijri | 1447-02-20 |
| Hebrew | 5785-12-19 |
| Buddhist | 2568-08-13 |
| Coptic | 1741-12-07 |
| Ethiopian | 2017-12-07 |
| Chinese | 2025-07-11 |
Note: Values for non-Gregorian calendars are calculated using the
intlextension. Actual results may vary slightly based on leap year and leap month handling.
Command Line Tool
The package includes a command-line tool (date-converter.sh) that allows you to convert dates between different calendar systems directly from your terminal without writing PHP code.
Usage
You can use the command-line tool in two ways:
Direct execution:
Using Composer alias:
Note: When using the Composer alias, use
--to separate Composer arguments from the script arguments.
Arguments
| Argument | Description |
|---|---|
date |
Optional. If not provided, current date (now) will be used. |
Options
| Option | Short | Description | Default |
|---|---|---|---|
--date-format |
-df |
Input calendar type (supported calendar systems) | gregorian |
--to |
-t |
Output calendar type (supported calendar systems) | gregorian |
--format-input |
-fi |
Input date string format (supported date formats), auto-detected if not provided | Auto-detect |
--format-output |
-fo |
Output date format (supported date formats) | Y-m-d |
--timezone |
-tz |
Convert time to specified timezone (e.g., Asia/Tehran, UTC, Europe/London) | None |
--from-timezone |
-ftz |
Source timezone for time conversion (e.g., UTC, Europe/London) | Auto-detect |
--to-timezone |
-ttz |
Target timezone for time conversion (e.g., Asia/Tehran, UTC) | None |
--help |
-h |
Show this help message | - |
Supported Calendar Systems
gregorianjalaliorpersianhijriorislamichebrewbuddhistcopticethiopianorethiopicchinese
Supported Date Formats
Y-m-dd/m/YF d YY/m/d H:i:s(with time)
Timezone Conversion
The command-line tool supports timezone conversion in two ways:
-
Simple timezone conversion (using
--timezonefor backward compatibility):- Converts the input time to the specified timezone
- Automatically detects the source timezone from the input date or uses default based on calendar type
- Explicit timezone conversion (using
--from-timezoneand--to-timezone):- Allows you to explicitly specify both source and target timezones
- More precise control over timezone conversion
- Automatically adds time to output format if timezone conversion is performed
Important Notes:
- When timezone conversion is performed and the input contains time, the output format will automatically include time (
H:i:s) if not already specified - If no time is present in the input, timezone conversion will not add time to the output
- Supported timezone formats: All PHP supported timezone identifiers (e.g.,
UTC,Asia/Tehran,Europe/London,America/New_York,Asia/Kabul,America/Sao_Paulo)
Timezone Conversion Examples:
Examples
Direct execution:
Using Composer alias:
License
The MIT License (MIT). Please see License File for more information.
Contributing
Thank you for considering contributing to the Laravel Multi Calendar! The contribution guide can be found in the CONTRIBUTING.md.
All versions of multi-calendar with dependencies
ext-intl Version *