Day of the Year Calculator

Convert any date to its day number (1–365/366), or look up which date a given day number falls on. Automatically handles leap years.

Today is Saturday, July 4, 2026

185
Day of the year
180
Days remaining in 2026
50.7%
Of 2026 elapsed
365
Total days (non-leap year)
2026 progress

Pick any date to instantly see its ordinal day number within the year.

What is the day of the year?

Each day of the year is assigned an ordinal number starting at 1. January 1st is day 1, February 1st is day 32, and December 31st is day 365 (or 366 in a leap year). This is also called the Julian day number or ordinal date and is widely used in astronomy, agriculture, project management, and financial reporting.

What is a leap year?

A leap year has 366 days instead of 365. A year is a leap year if it is divisible by 4, except for years divisible by 100 — unless it is also divisible by 400. For example, 2000 and 2024 are leap years, but 1900 is not. This calculator handles leap years automatically.

How to calculate the day of the year in Python

Use timetuple().tm_yday on any datetime or date object:

from datetime import date, timedelta # Date → day number d = date(2026, 7, 19) day_of_year = d.timetuple().tm_yday # 200 days_in_year = 366 if (d.year % 4 == 0 and d.year % 100 != 0) or d.year % 400 == 0 else 365 print(f"Day {day_of_year} of {days_in_year}") # Day number → date year = 2026 day_num = 200 result = date(year, 1, 1) + timedelta(days=day_num - 1) print(result.strftime("%B %d, %Y")) # July 19, 2026

How to calculate the day of the year in JavaScript

// Date → day number (DST-safe: uses UTC arithmetic) function getDayOfYear(date) { const start = Date.UTC(date.getFullYear(), 0, 0); const current = Date.UTC(date.getFullYear(), date.getMonth(), date.getDate()); return (current - start) / 86400000; } // Day number → date function getDateFromDayOfYear(dayNum, year) { return new Date(year, 0, dayNum); } console.log(getDayOfYear(new Date(2026, 6, 19))); // 200 console.log(getDateFromDayOfYear(200, 2026)); // July 19, 2026