Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to convert hijari date into gregorian date in java script?

Tags:

javascript

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.

like image 675
Arun Avatar asked Nov 09 '10 09:11

Arun


2 Answers

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.

like image 30
slebetman Avatar answered Sep 22 '22 17:09

slebetman


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

like image 133
The Archetypal Paul Avatar answered Sep 23 '22 17:09

The Archetypal Paul