Day of the year calculator
1 March 2024 is day 61 of the year; in a common year it would be day 60, since 2024 is a leap year. Enter a date to get its position in the year, the year's length and the days left until 31 December. Free in your browser.
- Free
- Runs in your browser
- No sign-up
- Your data stays on your device
Run — free
Worked example
- Date
- 2024-03-01
- Year
- 2,024
- Month
- 3
- Day
- 1
- Day of year
- 61
The day of the year, sometimes called the ordinal date or Julian day of the year, is the position of a calendar day inside its year counting from one on the first of January through three hundred sixty-five or three hundred sixty-six on the thirty-first of December. Engineers, analysts, and students need that ordinal when they label log files, schedule seasonal work, compare progress bars for annual goals, or convert between civil dates and day-number schemes used in science and aviation. This calculator accepts a single ISO calendar date in the strict form year-month-day with four digits, two digits, and two digits, checks that the day really exists on the Gregorian calendar including leap-year Februaries, and returns the day-of-year integer together with a leap flag, the length of the year, and how many days remain until December thirty-first. Impossible dates such as the twenty-ninth of February in a common year or the thirty-first of April fail with a clear validation error instead of a silent wrap.
How day-of-year is computed from an ISO date
Start with a calendar date written as year, month, and day in the international ISO form with hyphens and fixed widths so that every client agrees on the same three integers. First confirm that the year lies in a practical Gregorian range and that the month is between one and twelve. Next apply the leap-year rule used by civil calendars worldwide: a year is a leap year when it is divisible by four, except that century years are leap years only when they are also divisible by four hundred.
That rule makes February twenty-nine legal in years such as two thousand twenty-four and two thousand, and illegal in two thousand twenty-three and nineteen hundred. With leap status known, look up the length of each month for that year and reject any day that exceeds the month length, for example the thirty-first of April or the thirtieth of February. When the triple is valid, sum the lengths of every complete month before the given month and then add the day-of-month.
The sum is the day-of-year ordinal: January first is always one, March first is sixty-one in a leap year and sixty in a common year, and December thirty-first is three hundred sixty-six or three hundred sixty-five.
Where day-of-year calculators show up in real work
Operations teams often stamp batch jobs and warehouse partitions with day-of-year numbers so annual folders sort chronologically without multi-field date keys. Climate and agriculture notebooks plot series against day of year so multi-year seasons align even when leap days appear. Project managers track annual objectives as a fraction of the year by dividing the current ordinal by three hundred sixty-five or three hundred sixty-six.
Software that must stay free of time-zone libraries still needs a pure calendar ordinal for progress meters, maintenance windows, and compliance calendars that are defined by civil dates rather than Unix epochs. If you later need the count of business days between two dates, age from a birth date, full Julian day numbers, or week-of-year numbering under ISO eight thousand six hundred one, treat those as separate search intents and landings rather than overloading this day-of-the-year calculator page.
What you can do with it
Science and seasonal alignment
Map multi-year climate or agriculture series onto a shared 1–366 axis, correctly shifting March onward after leap days.
FAQ
What is day of the year?
It is the ordinal position of a calendar day inside its year: 1 for January 1, up to 365 in a common year or 366 in a leap year for December 31.
Does it handle leap years?
Yes. Gregorian leap rules apply: divisible by 4, except centuries must be divisible by 400. February 29 is accepted only in leap years and shifts later months by one day.
What date format is required?
Strict ISO YYYY-MM-DD with four-digit year and two-digit month and day. Values like 2024-3-1 or 2024/03/01 are rejected so every client agrees on the same string.
What happens with an invalid date such as 2023-02-29?
The error message explains that the day is not valid for that year and month.
What does it cost?
The browser tool is free and runs locally.
Related tools
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/day-of-year \
-H "Authorization: Bearer $KIT_KEY" \
-H "Content-Type: application/json" \
-d '{"date":"2024-03-01"}'const res = await fetch("https://api.kit.forhosting.com/date/day-of-year", {
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.KIT_KEY}`,
"Content-Type": "application/json"
},
body: JSON.stringify({
"date": "2024-03-01"
})
});
const { task_id } = await res.json();import os, requests
res = requests.post(
"https://api.kit.forhosting.com/date/day-of-year",
headers={"Authorization": f"Bearer {os.environ['KIT_KEY']}"},
json={
"date": "2024-03-01"
},
)
task_id = res.json()["task_id"]<?php
$res = file_get_contents("https://api.kit.forhosting.com/date/day-of-year", false, stream_context_create([
"http" => [
"method" => "POST",
"header" => "Authorization: Bearer " . getenv("KIT_KEY") . "\r\nContent-Type: application/json",
"content" => '{"date":"2024-03-01"}',
],
]));
$task = json_decode($res, true);body := bytes.NewBufferString(`{"date":"2024-03-01"}`)
req, _ := http.NewRequest("POST", "https://api.kit.forhosting.com/date/day-of-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-03-01"
}Example response
{
"task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
"type": "date.day_of_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. |
Technical notes
What you send and what you get back
Send one required string field named date containing a strict ISO calendar day such as two thousand twenty-four hyphen zero three hyphen zero one. Days that match the pattern but are not real calendar dates, including non-leap February twenty-nine and month values outside one through twelve, also fail with a message that names the problem so clients can correct the input without guessing. Classic checks include January first mapping to one, December thirty-first mapping to the full year length, and March first shifting by one day between leap and common years. Missing fields, non-string values, and strings that do not match the four-two-two digit pattern fail with invalid_input and are not charged. On success the response echoes the normalized date string, the numeric year, month, and day components, the day_of_year integer from one through three hundred sixty-five or three hundred sixty-six, a boolean is_leap_year flag, days_in_year as three hundred sixty-five or three hundred sixty-six, remaining_days until the last day of that year, and a short formula string that documents the leap rule. Pricing for successful API calls is the published base of $0.002 per item; validation failures do not consume prepaid balance.
Where day-of-year calculators show up in real work
Because this capability is a pure parse engine, API pricing is the published base of $0.002 per successful item and failed validation does not consume balance.
Integration use cases
Annual progress and goal trackers
Convert today’s ISO date to day_of_year and remaining_days so dashboards show percent of year complete without depending on host time zones.
Batch labels and log partitions
Stamp files and warehouse partitions with a stable ordinal day number derived from strict YYYY-MM-DD inputs and clear invalid_input on bad dates.