Question

I am trying to convert a Hijri date back to Gregorian with the internal function in the ar-SA calendar (other calendars seem to have the same toGregorian function). For example code try:

Globalize.cultures["ar-SA"].calendars.standard.convert.toGregorian("1434", "03", "11");

According to sites I've seen like: http://www.islamicity.com/prayertimes/defaulthijriconv.asp

"1434", "03", "11" should be 1/23/2013.

However, each date seems to be off by 2 days and this function returns.. 1/21/2013.. Is there a problem with this function? Or some other issue I could be having by using it?

Or can someone propose a js function which would do the correct conversion?

Was it helpful?

Solution

I figured out the problem it is because Month is zero based so the above code should be:

Globalize.cultures["ar-SA"].calendars.standard.convert.toGregorian("1434", "02", "11");

For todays date.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top