Does anybody know of a way to display the current date using the Islamic (Hajiri) date? Preferrably in PHP and/or Javascript.
Specifically in this format? "10 Safar, 1442"
I have been looking and looking and looking. I can find others using it, and when I search for "display Hajiri date", I get a bunch of sites about Muslim dating... not what I'm looking for, obviously.
I don't need anything special, just the date according to the location of the visitor to a site.
There is a Hijri Javascript library for Moment.js (https://ej2.syncfusion.com/documentation/calendar/islamic-calendar/); a quick Google for 'hijri calendar php' turns up a number of libraries for that language as well.
If you're interested in understanding how they work, perhaps implementing your own solution, I recommend the book Calendrical Calculations by Reingold and Dershowitz, which has a chapter on the Islamic calendar, and includes formulas that can be used to approximate it. That includes an attempt at observational accuracy that uses some relatively complex astronomical equations to compute the time of the lunar conjunction with a high degree of precision for dates around the present. The book comes with source code too, albeit in Lisp (the book grew out of the original implementation of the Hebrew calendar for Emacs by one of the authors).