Article — Day of the Year Calculator
Day of the year calculator
The day of the year, also called the ordinal date, is the position of a date inside its year, counted from 1. January 1 is day 1; December 31 is day 365 in a common year and day 366 in a leap year. March 1 sits at day 60 in 2025 and day 61 in 2024.
The format is defined by ISO 8601 as YYYY-DDD, a four-digit year and a three-digit day-of-year padded with leading zeros. April 10, 2026 is 2026-100. The format is used by some logging systems, by NASA mission timekeeping, and by anyone who has to sort or filter date strings without parsing them.
What the day of the year is
An ordinal date answers one question: which numbered day of this year is it? The arithmetic is the cumulative count of days from January 1 to the date in question, inclusive of January 1. The day of the year is sometimes called the Julian day in software documentation, but that term properly refers to a separate astronomical count starting in 4713 BC. To avoid confusion, the formal name is ordinal date.
Common applications are project planning (day 73 of the fiscal year), agricultural growing-degree-day models, satellite housekeeping logs, and the 030 / 060 / 090 milestones that some accounting systems still print on invoices.
The day of the year formula
For a date in month M and day-of-month D, the day of the year is the sum of the days in every completed month plus D. In a common year, that means add 31 for completed January, 28 for February, 31 for March, and so on, then add the day-of-month. In a leap year, February contributes 29 instead of 28, which shifts every March-through-December date forward by one.
DayOfYear = Σ days(month) + DCommon year = 365 daysLeap year = 366 daysRemaining = Total − DayOfYearLeap year and day of the year
The Gregorian leap-year rule has three parts, in the order they apply: years divisible by 4 are leap years, except years divisible by 100, except years divisible by 400. So 2000 was a leap year (divisible by 400), but 1900 was not (divisible by 100 but not 400). 2024 is a leap year, 2025 is not, 2028 will be.
The rule shifts the day-of-year for every date after February 28 by one in leap years. March 1 is day 60 in 2025 (common year) but day 61 in 2024 (leap year). December 31 is day 365 in a common year and day 366 in a leap year. The average Gregorian year is 365.2425 days, within 27 seconds of the true tropical year of 365.24219 days.
The simple "divisible by 4" rule is wrong about three days every 400 years. Pope Gregory XIII added the century-and-400 exceptions in 1582 to fix the drift the Julian calendar had accumulated since 46 BC. Catholic Europe jumped straight from October 4 to October 15, 1582 to absorb the accumulated 10-day error.
ISO 8601 ordinal date format
ISO 8601 standardizes the ordinal date as YYYY-DDD. The day-of-year always carries three digits, padded with zeros. January 1 is YYYY-001, not YYYY-1. The format sorts lexicographically — alphabetical order matches chronological order — which makes it useful as a filename prefix or a database key for logs.
The closely-related ISO week date format is YYYY-Www-D, where ww is the week number (01-53) and D is the day of week (1 = Monday, 7 = Sunday). Both representations refer to the same calendar day but answer different questions.
Day of the year table
The cumulative days at the end of each month in a common year and a leap year:
- Jan = 31 / 31
- Feb = 59 / 60
- Mar = 90 / 91
- Apr = 120 / 121
- May = 151 / 152
- Jun = 181 / 182
- Jul = 212 / 213
- Aug = 243 / 244
- Sep = 273 / 274
- Oct = 304 / 305
- Nov = 334 / 335
- Dec = 365 / 366
To find the day of the year for, say, July 4, take the cumulative end-of-June number (181 or 182) and add 4. July 4, 2026 is day 185.
ISO week number vs day of the year
The two numbers answer different scheduling questions. Day of the year is a count from January 1; ISO week is a count of Monday-Sunday weeks anchored on the first Thursday of January. A year has 52 ISO weeks most of the time and 53 weeks when it starts on a Thursday (or on a Wednesday in a leap year).
2026 is a 53-week ISO year because January 1, 2026 is a Thursday. The last few days of December 2026 fall in W53 of 2026, and January 1, 2027 — a Friday — belongs to W53 of 2026 as well. The first ISO week of 2027 starts on Monday, January 4.
If a finance or payroll system uses 4-week or 13-period months, ISO week numbers line up cleanly with those periods. Ordinary day-of-year counts do not — day 28, day 56, day 84 are not Mondays in general.
Day of the year worked example
What is the day of the year for March 15, 2026? Take the end-of-February cumulative number for a common year (2026 is not divisible by 4): 59. Add the day of month: 59 + 15 = 74. So March 15, 2026 is day 74. The ISO ordinal form is 2026-074. Days remaining in 2026 from March 15 inclusive: 365 − 74 = 291 (counting March 15 as a remaining day) or 291 if you count the days strictly after the target date.
Software conventions differ on whether "days remaining" includes the start date. The calculator above uses the exclusive convention — March 15 is not in the remaining count. Add 1 to compare with tools that count inclusively.
Day of the year quick reference
- Jan 1 = day 1
- Mar 1 (common) = day 60
- Mar 1 (leap) = day 61
- Jul 4 = day 185 (common) / 186 (leap)
- Dec 31 (common) = day 365
- Dec 31 (leap) = day 366
- Leap rule = ÷4, not ÷100, unless ÷400
One last note. The astronomical Julian Day Number for May 13, 2026 is 2,461,174. The ordinal date for the same day is 2026-133. The two are not interchangeable; only the ordinal form belongs in everyday calendar work.