ForHosting KIT · Developer Utilities

Hijri month length calculator

This Hijri month length calculator returns the number of days in a specified year and month of the tabular Islamic calendar.

● BetaFree · in your browser
Use it from WebAPIEmailTelegramApp soon

Enter a Hijri year from 1 AH onward and a month number from 1 through 12. The result identifies whether that month contains twenty-nine or thirty days and whether the supplied year is a tabular leap year. It uses fixed calendar arithmetic, so identical inputs always produce identical results without consulting an observation service, location, clock, or external calendar feed.

What this calculator tells you

A Hijri month can contain twenty-nine or thirty days, and the answer depends on which Islamic calendar convention is being used. This calculator answers the question specifically for the tabular Islamic calendar, a rule-based system that organizes years into a repeating thirty-year cycle. Supply the Hijri year as a positive integer and the month as a number from 1 through 12. The response repeats those inputs, reports the month length in the days field, and marks whether the year is a tabular leap year. That compact result is useful in validation rules, date pickers, schedules, teaching materials, and systems that already store tabular Hijri dates. It does not convert the date to the Gregorian calendar, identify a month by local naming conventions, or determine when a visible crescent was observed. By stating the calendar model directly, the result remains precise: it is an arithmetic calendar answer, not a claim about a religious authority's announced month boundary in a particular country.

How the tabular calculation works

The tabular Islamic calendar alternates month lengths in a regular pattern. Odd-numbered months normally have thirty days, while even-numbered months have twenty-nine. The twelfth month is the exception that connects the monthly pattern to the leap-year cycle: it has twenty-nine days in an ordinary year and thirty days in a leap year. Leap years are selected deterministically within a repeating cycle of thirty Hijri years. The calculation evaluates the supplied year against that cycle using integer arithmetic, then applies the appropriate rule for the supplied month. There is no dependence on the current date, a machine's local timezone, daylight-saving rules, geographic coordinates, network availability, or randomized data. Although the computation is suitable for execution in UTC environments, it never needs to construct a clock-based date at all. This avoids the common error of mixing local date methods with UTC serialization and guarantees that a browser and an API worker receive the same result for the same two integers.

Choose the calendar convention before relying on the result

Use this result when your specification explicitly calls for the tabular Islamic calendar or when deterministic arithmetic is more important than matching a locally proclaimed lunar month. It is especially appropriate for software tests, historical calculations that adopt a stated tabular convention, offline tools, and database constraints designed around the thirty-year cycle. Do not treat the answer as a substitute for an observational calendar, a national calendar authority, or a calendar such as Umm al-Qura. Those systems can assign month boundaries from observations, predictions, or published tables and may therefore differ from the tabular result. A sound integration records the convention alongside the stored Hijri date, validates that the year is at least 1 and the month is between 1 and 12, and uses the returned days value as the maximum permitted day. The endpoint costs $0.002 per request when automated through the API, while the same deterministic logic can run in the browser for an immediate individual check.

Validate a tabular Hijri date

Set the maximum accepted day for a stored Hijri year and month before saving a form or importing records.

Build a deterministic date picker

Populate the correct number of day choices without relying on a clock, timezone, network request, or changing observation feed.

Create repeatable calendar tests

Generate stable expectations for ordinary and leap years in software that explicitly implements the tabular Islamic calendar.

What does the API request cost?

Each API request costs $0.002. An individual calculation can also run in the browser.

Does this use moon sightings?

No. It uses the deterministic tabular Islamic calendar and does not consult observations or announcements.

Why can another Hijri calendar show a different month length?

Observational calendars and published regional calendars can use different rules or data. This result applies only to the stated tabular convention.

How is the twelfth month handled?

Month 12 has twenty-nine days in an ordinary tabular year and thirty days in a tabular leap year.

Is the result affected by timezone?

No. The calculation uses only the supplied integer year and month and does not create or read a clock-based date.

Everything on this page is available programmatically. This section is for teams who want to wire it into their own systems; everyone else can just use the tool above.

POSThttps://api.kit.forhosting.com/date/hijri-month-length

Prefer to automate it? One authenticated POST creates the task; the result comes back by webhook or a signed link. The same capability also runs here on the web, by email and from Telegram — and soon from our app too.

curl -X POST https://api.kit.forhosting.com/date/hijri-month-length \
  -H "Authorization: Bearer $KIT_KEY" \
  -H "Content-Type: application/json" \
  -d '{"year":1446,"month":12}'
{
  "year": 1446,
  "month": 12
}
{
  "task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
  "type": "date.hijri_month_length",
  "status": "queued",
  "_links": {
    "result": "/tasks/tsk_…/result"
  }
}

The API is asynchronous: the call returns a task_id immediately and the result arrives by webhook. Polling is capped at 1 req/s per task.

Per request$0.002

Published price — no tokens, no invented credits. A failed task is never charged.

HTTPCodeMeaning
401unauthorizedMissing or invalid API key.
402insufficient_balanceYour balance doesn't cover the task price.
404unknown_typeThat task type doesn't exist.
429rate_limitedToo many requests. Use the webhook instead of polling.

Read the full KIT documentation →