1. Go to this page and download the library: Download eram/daynum library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
eram / daynum example snippets
use Eram\Daynum\Instant;
use Eram\Daynum\Calendar\Jalali\JalaliView;
// Construction — one calendar to pick from, three calendars to read back
$d = Instant::fromGregorian(2026, 4, 8, 14, 30, 0, 'Asia/Tehran');
$d->gregorian()->format('Y-m-d'); // "2026-04-08"
$d->jalali()->format('Y/m/d'); // "1405/01/19"
$d->hijri()->format('j F Y'); // "21 Shawwal 1447"
// Persian locale + Persian digits
$d->jalali()->withLocale('fa')->withDigits('persian')->format('l j F Y');
// "چهارشنبه ۱۹ فروردین ۱۴۰۵"
// Immutable arithmetic — returns Instant, re-enter a view to format
$next = $d->jalali()->addMonths(1); // Instant
$next->jalali()->format('Y/m/d'); // "1405/02/19"
// Strict parsing — digits in any script are normalized
JalaliView::parseExact('۱۴۰۵/۰۱/۱۹', 'Y/m/d'); // Instant
JalaliView::tryParseExact('nope', 'Y/m/d'); // null
// JSON round-trip contract
json_encode($d);
// {"jdn":2461139,"secondsOfDay":52200,"tzLabel":"Asia/Tehran"}
Instant::fromArray(json_decode(json_encode($d), true))->equals($d); // true
// Escape hatch to native PHP for real timezone math
$d->toDateTimeImmutable();
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.