I am using intalio editor in that I want to convert the Hijri date into a Gregorian date or vice-versa. we write code in javascript using jsx3 so please help me.
-
Normally I'd agree, but this conversion isn't trivial so I suspect it may not be homework – The Archetypal Paul Nov 09 '10 at 09:55
4 Answers
For Gregorian->Hijiri, see here
Bidirectional C# version here that could be converted to Javascript
EDIT: An excellent page and convertors can be found here. That page says:
All calculations are done in JavaScript executed in your own browser; complete source code is embedded in or linked to this page, and you're free to download these files to your own computer and use them even when not connected to the Internet.
which suggests to me you can use the code, but you probably want to check with the page author

- 1
- 1

- 41,321
- 20
- 104
- 134
-
First link is broken, the second one refers to self. That is why it is so important to copy code into your post instead of just giving external links. [Here is the only viewable](http://junaedhalim.blogspot.com/2010/01/hijri-calendar-in-java-using-kuwaiti.html) code sample I was able to find. (Although it's in Java.) – ahmd0 Apr 25 '18 at 05:28
-
Fortunately, the third one works still. It's 8 year ago so I don't recall what was on the page, but they may well have been copyrighted, or a lot of code, so I wasn't about to copy the code into the question. – The Archetypal Paul Apr 25 '18 at 09:24
It helps to know that muslims refer to the Gregorian calendar as Masihi. Googling for "hijrah to masihi converter" turns up this page as the second hit: http://www.islamicity.com/PrayerTimes/defaultHijriConv.asp
The javascript is code contains two functions GregToIsl
and IslToGreg
that does what you want.
There is a copyright notice on that page so you shouldn't simply copy-paste the code. But the functions are short enough for you to extract the relevant maths out of.
The maths/algorithm itself is almost a thousand years old so it shouldn't have any legal restriction.

- 109,858
- 19
- 140
- 171
-
Note: Muslims refer to Gregorian Calendar as "Miladi" not "Masihi". – Mohsen Alyafei Feb 27 '22 at 07:28
-
@MohsenAlyafei I am a Muslim and Muslims in South East Asia refer to the Gregorian Calendar as "Masihi" which is what I know. I do not speak Arabic. I speak Malay. And we Muslims don't refer to it as "Miladi". I've never heard of that word until reading your comment. Fortunately Google understands Malay so will give you good results with the above search term. You can write your own answer if you have a better search term for Google. – slebetman Feb 27 '22 at 19:38
-
Please see here: https://ar.wikipedia.org/wiki/%D8%AA%D9%82%D9%88%D9%8A%D9%85_%D9%85%D9%8A%D9%84%D8%A7%D8%AF%D9%8A – Mohsen Alyafei Feb 28 '22 at 08:29
-
Here is my simple solution: https://stackoverflow.com/questions/71222556/how-to-convert-any-of-the-5-islamic-hijri-calendars-dates-to-any-of-18-world – Mohsen Alyafei Feb 28 '22 at 08:32