开发者

how to convert Hijari date into Gregorian date in javascript?

I am using intalio editor in that I want to convert the Hijri date i开发者_如何学Gonto a Gregorian date or vice-versa. we write code in javascript using jsx3 so please help me.


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


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.


Try dojox.date.islamic


In Javascript the correct way for such conversion is to use Intl object (read more) as following:

a = new Date();
localeFormat= 'ar-SA-islamic-umalqura';
Intl.DateTimeFormat(localeFormat).format(a)
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜