Count a specific weekday in a year from an ISO date
Count exactly how many Mondays, Fridays, Sundays, or any other chosen weekday occur in the calendar year identified by an explicit ISO date.
Run — free
The calculator validates the complete date, extracts its year, and applies Gregorian calendar rules with deterministic integer arithmetic. It never depends on the machine clock, locale settings, daylight-saving changes, or a runtime date parser. The result includes the normalized weekday, count, leap-year status, year length, and weekday of January 1, making the answer easy to inspect or automate.
Provide an explicit date and weekday
Send a date written exactly as YYYY-MM-DD and a weekday name such as Monday, Tuesday, or Friday. The date is explicit because it determines the calendar year to examine; its month and day do not limit the counting interval. For example, both 2024-01-01 and 2024-11-30 select the complete 2024 calendar year. The full date must still represent a real Gregorian day, so impossible inputs such as 2023-02-29 or a thirteenth month are rejected instead of being silently normalized. Weekday names are matched without regard to letter case, and familiar three-letter English abbreviations such as Mon, Wed, and Sat are accepted. The response repeats the original date, identifies the selected year, normalizes the weekday to its full English name, and reports a Sunday-origin weekday index. Requiring these two clear inputs prevents hidden dependence on the current date and makes stored requests reproducible long after they were created. It also keeps the API suitable for forms, scheduled jobs, spreadsheets, and audit records where an implicit year would be ambiguous.
Understand how the deterministic count works
Every ordinary Gregorian year contains 365 days, which is exactly 52 complete weeks plus one additional day. A leap year contains 366 days, or 52 complete weeks plus two additional days. Therefore every weekday occurs at least 52 times. In an ordinary year, the weekday on January 1 occurs for a fifty-third time. In a leap year, the weekdays on January 1 and January 2 each occur 53 times. The calculator first applies the Gregorian leap-year rule: years divisible by four are leap years, except century years unless they are also divisible by 400. It then computes the weekday of January 1 using bounded integer arithmetic and checks whether the chosen weekday falls among the one or two additional days. No JavaScript Date object is constructed. That choice avoids implementation-dependent parsing, host time zones, daylight-saving transitions, and locale behavior. The returned year length, leap-year flag, and January 1 weekday expose the key facts behind the answer, so a count of 52 or 53 can be checked without treating the endpoint as a black box.
Use the result in planning and validation
A weekday count is useful whenever a yearly estimate depends on a recurring weekly event. Payroll teams can establish the number of regular Friday pay dates before accounting for holidays. Operations teams can estimate Monday opening days, schools can measure potential teaching weekdays, and analysts can validate calendar dimensions generated by another system. Treat the result as a pure calendar count, not as a business-day total. Public holidays, organization closures, leave, regional observances, and exceptional schedules are deliberately outside the calculation, because they require a jurisdiction and policy that are not present in the inputs. If those exclusions matter, use this count as the transparent baseline and subtract dates according to your own calendar. The explicit ISO date also helps pipelines that already carry a reporting date: callers do not need to split out or separately validate its year before requesting the count. Browser and API executions use the same pure solver, so identical inputs produce identical JSON. Automated API requests are priced at $0.002, while the deterministic structure makes results straightforward to cache by year and normalized weekday when repeated reporting workflows ask the same question.
What you can do with it
Estimate recurring workdays
Count all occurrences of a scheduled weekday in a reporting year before subtracting holidays or closures.
Check payroll calendars
Confirm whether a selected weekly payday appears 52 or 53 times in the year attached to a payroll date.
Validate calendar datasets
Compare a generated yearly calendar's weekday totals with a deterministic Gregorian baseline.
FAQ
What does an API request cost?
Each API request costs $0.002.
Why do I provide a full date instead of only a year?
The explicit, validated ISO date supplies the year and fits workflows that already use reporting or reference dates.
Can a weekday occur more than 53 times in one year?
No. A Gregorian year has 52 full weeks plus only one or two additional days.
Are holidays excluded?
No. The result counts calendar weekdays only and does not apply regional or organizational holiday rules.
Does time zone affect the answer?
No. The solver uses only the written ISO date and Gregorian integer arithmetic, with no local clock or Date parsing.
For developers — API access
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.
API endpoint
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.
Call it from your stack
curl -X POST https://api.kit.forhosting.com/date/count-weekday-in-year \
-H "Authorization: Bearer $KIT_KEY" \
-H "Content-Type: application/json" \
-d '{"date":"2024-06-15","weekday":"Monday"}'const res = await fetch("https://api.kit.forhosting.com/date/count-weekday-in-year", {
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.KIT_KEY}`,
"Content-Type": "application/json"
},
body: JSON.stringify({
"date": "2024-06-15",
"weekday": "Monday"
})
});
const { task_id } = await res.json();import os, requests
res = requests.post(
"https://api.kit.forhosting.com/date/count-weekday-in-year",
headers={"Authorization": f"Bearer {os.environ['KIT_KEY']}"},
json={
"date": "2024-06-15",
"weekday": "Monday"
},
)
task_id = res.json()["task_id"]<?php
$res = file_get_contents("https://api.kit.forhosting.com/date/count-weekday-in-year", false, stream_context_create([
"http" => [
"method" => "POST",
"header" => "Authorization: Bearer " . getenv("KIT_KEY") . "\r\nContent-Type: application/json",
"content" => '{"date":"2024-06-15","weekday":"Monday"}',
],
]));
$task = json_decode($res, true);body := bytes.NewBufferString(`{"date":"2024-06-15","weekday":"Monday"}`)
req, _ := http.NewRequest("POST", "https://api.kit.forhosting.com/date/count-weekday-in-year", body)
req.Header.Set("Authorization", "Bearer "+os.Getenv("KIT_KEY"))
req.Header.Set("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)Example request
{
"date": "2024-06-15",
"weekday": "Monday"
}Example response
{
"task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
"type": "date.count_weekday_in_year",
"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.
Pricing
Published price — no tokens, no invented credits. A failed task is never charged.
Errors
| HTTP | Code | Meaning |
|---|---|---|
401 | unauthorized | Missing or invalid API key. |
402 | insufficient_balance | Your balance doesn't cover the task price. |
404 | unknown_type | That task type doesn't exist. |
429 | rate_limited | Too many requests. Use the webhook instead of polling. |