There are a couple of ways to achieve this, but one common method is to use the jDateTime library.
You can install it using Composer:
main.php34 chars2 lines
Then, you can use it like this:
main.php308 chars11 lines
This converts a given timestamp (in Gregorian calendar) to a string representing the same date in Jalali calendar.
Note that jDateTime library includes many other features, such as formatting, localization, timezone handling, etc. You can check its documentation for more information.
gistlibby LogSnag