sorkh.shahin / jalalicalendar
Jalali Calendar
Installs: 4 113
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 2
Forks: 0
Open Issues: 0
Requires
- php: >=7.4
Requires (Dev)
README
A php native-like package for use of Persians and everyone who uses Jalali calendar and wants to get rid of Arabic characters in their php applications.
Installation
You can use composer to install this calendar
$ composer require sorkh.shahin/jalalicalendar
Usage
This package is under ShSo\Jalali
namespace and does two things:
- Provides Jalali date/time using
ShSo\Jalali\DateTime
class - Converts English and Arabic numbers to Persian and vice versa using
ShSo\Jalali\Converter
class
How to use
All methods and functionalities are static methods of the classes ShSo\Jalali\DateTime
and ShSo\Jalali\Converter
ShSo\Jalali\DateTime
provides:
date()
Jalali equivalent of php native date() function with options to choose whether use Persian numbers and choose different timezonestrftime()
Jalali equivalent of php native strftime() function with options to choose whether use Persian numbersmktime()
Jalali equivalent of php native mktime() functioncheckdate()
Jalali equivalent of php native checkdate() functiongetdate()
Jalali equivalent of php native getdate() functiongregorianToJalali()
Converts Gregorian date to JalalijalaliToGregorian()
Converts Jalali date to GregoriandayOfYear()
Returns number of passed days since the start of the year,dayOfYear(6,8)
returns 163isLeapYear()
Returns true if the given year is leap or false otherwisedayOfMonth()
Returns number of days in the month,dayOfMonth(12,1395)
returns 30getMonthName()
Returns the name of the month, whether in full or short and in Persian or EnglishgetWeekName()
Returns day of week in Gregorian order whether in Persian or EnglishgetShortWeekName()
Returns day of week in Gregorian order in 3 letters whether in Persian or English
ShSo\Jalali\Converter
provides:
numToPersian()
Converts all numbers whether in English or Arabic to PersiannumToEnglish()
Converts all numbers whether in Arabic or Persian to EnglisharabicToPersian()
Converts ('ي', 'ك', 'ة') to ('ی', 'ک', 'ه') and ('٤', '٥', '٦') to ('۴', '۵', '۶')
License
This package is under MIT License.