Skip to content

AmirHossein/jCalendar

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

jCalendar

Persian Calendar functions

Implementing PHP date, getdate, and mktime functions for Perisan calendar

Latest Stable Version Total Downloads Latest Unstable Version License

Install:

composer require ahhp/jcalendar

Usage:

$t = strtotime('2021-09-23 05:00:00 +00:00'); // UNIX timestamp

ahhp\jCalendar\jCalendar::date('Y/m/d H:i:s', $t); // ۱۴۰۰/۰۷/۰۱ ۰۵:۰۰:۰۰

ahhp\jCalendar\jCalendar::date('Y-m-d H:i:s', $t, false); // 1400-07-01 05:00:00

ahhp\jCalendar\jCalendar::getdate($t, false);
/* See php getdate function
[
    [0] => 1632373200
    [mday] => 1
    [wday] => 5
    [mon] => 7
    [year] => 1400
    [yday] => 187
    [weekday] => پنجشنبه
    [month] => مهر
]
*/

$timestamp = ahhp\jCalendar\jCalendar::mktime(5, 0, 0, 7, 1, 1400); // 1400-07-1 05:00:00
date('r', $timestamp); // Thu, 23 Sep 2021 05:00:00 +0000

// Converters
ahhp\jCalendar\jCalendar::gregorian_to_jalali(2021, 9, 23); // [1400, 7, 1]
ahhp\jCalendar\jCalendar::jalali_to_gregorian(1400, 7, 1); // [2021, 9, 23]

About

Jalali Calendar PHP Class

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages