PHP code example of pasoonate / pasoonate-php

1. Go to this page and download the library: Download pasoonate/pasoonate-php 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/ */

    

pasoonate / pasoonate-php example snippets


use Pasoonate\Pasoonate;

function pasoonate(): CalendarManager
{
    return Pasoonate::make();
}

// Set timestamp 📌
$date = pasoonate()->setTimestamp(1333857600)->jalali()->format('yyyy-MM-dd');

// Convert Jalali to Gregorian 🌍
$datetime = pasoonate()->jalali('1398/02/01 20:00:00')->gregorian()->getDatetime();

// Get today's date in different calendars 📆
$date = pasoonate()->jalali()->format('yyyy-MM-dd'); // 1403-10-29 🏷️
$date = pasoonate()->gregorian()->format('yyyy-MM-dd'); // 2025-01-18 📅
$date = pasoonate()->islamic()->format('yyyy-MM-dd'); // 1446-07-18 🌙
$date = pasoonate()->shia()->format('yyyy-MM-dd'); // 1446-07-17 ✨

// Date conversion 🔄
$date = pasoonate()->jalali()->addDay(2)->gregorian()->format('yyyy-MM-dd');

// Parse and format dates 📖
pasoonate()->jalali()->parse('yyyy-MM-dd', '1403-10-10')->addDay(3)->format('yyyy-MM-dd'); //1403-10-13

$today = pasoonate()->jalali()->format('Y/m/d');

$gregorianDate = pasoonate()->jalali('1403/10/10')->gregorian()->format('Y-m-d');

$jalaliDate = pasoonate()->gregorian('2025-01-18')->jalali()->format('Y/m/d');

$startOfMonth = pasoonate()->jalali()->startOfMonth()->format('Y/m/d');
$endOfMonth = pasoonate()->jalali()->endOfMonth()->format('Y/m/d');

$startOfYear = pasoonate()->jalali()->startOfYear()->format('Y/m/d');
$endOfYear = pasoonate()->jalali()->endOfYear()->format('Y/m/d');

$isLeap = pasoonate()->jalali()->isLeapYear(); // Returns true or false

$dayOfWeek = pasoonate()->jalali()->dayOfWeek(); // 0 = Saturday, 6 = Friday

$weekNumber = pasoonate()->jalali()->weekOfYear();

echo $today->jalali('1399/01/15 11:22:00')->addYear(1)->format('Y/m/d H:i:s');
// 🗓️ 1400/01/15 11:22:00

echo $today->jalali()->addMonth(1)->format('Y/m/d H:i:s');
// 🗓️ 1400/02/15 11:22:00

echo $today->jalali()->addDay(3)->format('Y/m/d H:i:s');
// 🗓️ 1400/02/18 11:22:00

echo $today->jalali()->addHour(4)->format('Y/m/d H:i:s');
// ⏳ 1400/02/18 15:22:00

echo $today->jalali()->addMinute(2)->format('Y/m/d H:i:s');
// ⏲️ 1400/02/18 15:24:00

echo $today->jalali()->addSecond(35)->format('Y/m/d H:i:s');
// ⏰ 1400/02/18 15:24:35

echo $today->jalali()->subYear(1)->format('Y/m/d H:i:s');
// 📅 1399/02/18 15:24:35

echo $today->jalali()->subMonth(1)->format('Y/m/d H:i:s');
// 📆 1399/01/18 15:24:35

echo $today->jalali()->subDay(3)->format('Y/m/d H:i:s');
// 🗓️ 1399/01/15 15:24:35
bash
composer