Guide · 8 min read

How to convert a Hijri date to Gregorian by hand

Every date converter, including this one, works the same way underneath: it never converts a Hijri date to a Gregorian date directly. It converts the Hijri date to a Julian Day Number - a single running count of days - and then converts that number to a Gregorian date. Each calendar only has to know its own relationship to that count, and the two never have to know anything about each other.

The arithmetic is small enough to do on paper. This guide walks the whole pipeline both ways with a real date, using the exact constants and formulas HijriConv itself uses, so the answer you get by hand is the answer the converter gives. It closes by explaining why two perfectly correct converters can still disagree with each other by a day.

The pivot: the Julian Day Number

A Julian Day Number, or JDN, is just a count of days from a fixed starting point far in the past. Today's is somewhere around 2.46 million. It has no months, no years and no leap rules - it is one integer that goes up by one every day.

That is what makes it useful. Subtracting two JDNs gives you the number of days between two dates with no calendar arithmetic at all, and any calendar can be defined purely by where its day one sits on that number line. For the tabular Islamic calendar there are two such anchors, and picking the wrong one is the single most common source of one-day errors.

Both variants are offered on the converter. The astronomical variant simply reads one day ahead of the civil one, always.

  • Tabular civil - 1 Muharram 1 AH sits at JDN 1948440, a Friday, which is 19 July 622 CE in the proleptic Gregorian calendar. This is the epoch the Unicode and ISO "islamic-civil" calendars use, and HijriConv's tabular default.
  • Tabular astronomical - 1 Muharram 1 AH sits one day earlier at JDN 1948439, a Thursday. This is the "islamic-tbla" rule.

Step 1 - Hijri date to a day count

Take the date 1 Ramadan 1447 AH and convert it in the tabular civil calendar. The first job is to count the days from 1 Muharram 1 AH up to the date in question, which breaks into three pieces: whole years, whole months, and days into the month.

For the whole years, the tabular calendar packs 11 long years into every 30, so the count of days before the start of Hijri year Y is 354 × (Y − 1) plus the number of long years already elapsed - the first formula below.

With Y = 1447 that is 354 × 1446 = 511884, plus 530, giving 512414 days before the year even starts.

For the whole months, the tabular calendar alternates 30 and 29 day months, so the days elapsed before month M begins is the ceiling of 29.5 × (M − 1). For Ramadan, month 9, that is the ceiling of 236, which is 236.

Then add the day of the month, minus one, because the first of the month is day zero of the elapsed count. For day 1 that adds nothing.

  • days before year = 354 × (Y − 1) + floor((11 × (Y − 1) + 3) / 30)
  • days before month = ceil(29.5 × (M − 1))
  • JDN = epoch + days before year + days before month + (day − 1)

Step 2 - day count to a Julian Day Number

Add the three pieces to the civil epoch and you have the JDN: 1948440 + 512414 + 236 + 0 = 2461090.

That single number is now the whole answer. Everything from here is Gregorian arithmetic, and the Hijri calendar never appears again.

The weekday falls out for free, with no month lengths and no calendar rules at all. JDN 0 was a Monday, so taking (JDN + 1) modulo 7 gives 0 for Sunday through 6 for Saturday. Here (2461090 + 1) modulo 7 is 3, which is Wednesday.

Step 3 - Julian Day Number to a Gregorian date

This is the standard Fliegel and Van Flandern integer algorithm, and it is exact for every date HijriConv handles. Every division below is integer division, discarding the remainder.

Running it on JDN 2461090: a = 2493134, b = 68, c = 9485, d = 25, e = 354, and m = 11. The day is 354 − 337 + 1 = 18, the month is 11 + 3 − 12 = 2, and the year is 6800 + 25 − 4800 + 1 = 2026.

So 1 Ramadan 1447 AH in the tabular civil calendar is Wednesday 18 February 2026. Type the same date into the converter with the tabular civil calendar selected and it returns exactly that.

  • a = JDN + 32044
  • b = (4a + 3) / 146097, then c = a − (146097b / 4)
  • d = (4c + 3) / 1461, then e = c − (1461d / 4)
  • m = (5e + 2) / 153
  • day = e − ((153m + 2) / 5) + 1
  • month = m + 3 − 12 × (m / 10)
  • year = 100b + d − 4800 + (m / 10)

Going the other way

Gregorian to Hijri runs the same pipeline backwards, and it starts with the companion formula that turns a Gregorian date into a JDN. Set a = (14 − month) / 12, then y = year + 4800 − a and m = month + 12a − 3, all in integer arithmetic.

The JDN is then day + ((153m + 2) / 5) + 365y + (y / 4) − (y / 100) + (y / 400) − 32045.

Take 18 February 2026 back through it. Here a = 1, y = 6825 and m = 11, so the sum is 18 + 337 + 2491125 + 1706 − 68 + 17 − 32045 = 2461090 - the same number we produced from the Hijri side, which is the check that the two directions agree.

To finish, subtract the epoch: 2461090 − 1948440 = 512650 days since 1 Muharram 1 AH. Estimate the year with (30 × 512650 + 10646) / 10631 = 1447, confirm that year 1447 starts at or before this JDN and year 1448 starts after it, then subtract the year start: 2461090 − 2460854 = 236 days into the year. Looking that up against the month offsets - 0, 30, 59, 89, 118, 148, 177, 207, 236, 266, 295, 325 - 236 is exactly the start of month 9, so the answer is 1 Ramadan 1447 AH.

Why two converters disagree

Everything above is the tabular calendar, and it is entirely mechanical. The Umm al-Qura calendar cannot be done this way at all: its month lengths come from official published tables rather than a rule, so a converter that implements it has to carry the data. HijriConv embeds those tables for 1318-1499 AH and falls back to the tabular calendar outside that window.

That is the first and biggest reason two converters disagree. Ask both for 1 Muharram 1447 AH and Umm al-Qura answers 26 June 2025 while the tabular civil rule answers 27 June 2025. Neither is broken; they are different calendars.

Four things account for almost every discrepancy you will meet in practice.

The practical defence is to always state which calendar a Hijri date belongs to, and, when comparing two tools, convert a date both ways and check you get back what you started with.

  • Different calendar. Umm al-Qura against the tabular rule is a genuine difference of system, not of accuracy, and can be a full day.
  • Different epoch. Tabular civil against tabular astronomical is always exactly one day, and it is the most common silent cause.
  • Out of range. Umm al-Qura implementations cover different year spans and fall back to something else - often silently - outside them.
  • A local offset. Some devices and calendar apps let the user shift the Hijri date by a day or two to match a local announcement, and then export that shifted date.

One thing arithmetic cannot give you

None of this is a moon sighting. The pipeline above is civil calculation from beginning to end, and so is every date on this site. A calculated date can differ by about a day from the crescent sighting a local authority announces, and that authority's announcement is what determines the start of Ramadan, the Eids and the days of Hajj.

Use the arithmetic for planning, for record-keeping, for converting a birth date or a historical document, and for understanding why the numbers move. For fasting, Eid, Hajj and other observances, follow the ruling of your local religious authority.

Frequently asked questions

What is a Julian Day Number?

A continuous count of days from a fixed point far in the past, with no months, years or leap rules attached. Date converters use it as a neutral pivot: each calendar defines only its own mapping to and from the count, so Hijri and Gregorian never have to know anything about each other. Subtracting two JDNs gives the exact number of days between the dates.

Why do I get a date one day off from another converter?

Most often because of the epoch. The tabular calendar comes in a civil variant anchored at JDN 1948440 and an astronomical variant anchored one day earlier at 1948439, so the astronomical one always reads a day ahead. The other common cause is comparing the Umm al-Qura table against a tabular rule, which are different calendars rather than different accuracies.

Can I do Umm al-Qura conversion by hand?

Not from a formula, because there isn't one. Umm al-Qura month lengths are published year by year in official tables, so any conversion has to look them up. You can still do the JDN half by hand: find the JDN of the first of the Hijri month from a published table, add the day minus one, then run the Gregorian algorithm on the result.

Does this arithmetic tell me when Ramadan starts?

It tells you the calculated date, not the announced one. Every date produced this way is a civil calculation and can differ by about a day from a local crescent sighting. For fasting, Eid, Hajj and other observances, follow the announcement of your local religious authority rather than any calculation, including this site's.

How do I get the weekday without a calendar?

Straight from the JDN. Because JDN 0 was a Monday, (JDN + 1) modulo 7 gives 0 for Sunday through 6 for Saturday, and it works for any date in either calendar with no month lengths or leap rules involved. For JDN 2461090 the result is 3, which is Wednesday.

Look it up

The pages behind this guide.

More guides