Intermediate

Day of Year (Ordinal Date)

Convert any calendar date into its day-of-year number, ordinal date, and the count of days left in that year.
Enter a calendar date in YYYY-MM-DD format
Day of year
177

Ordinal date: 2026-177

Jan 1Dec 31Day 177 of 365Days elapsed and remaining in the year
Ordinal date (YYYY-DDD)
2026-177
Days remaining in year
188
Total days in year
365
Leap year
No
Step by step
  1. 1

    Elapsed milliseconds

    date − Jan 0 of 2026 = 15,375,600,000
    Jan 0 (Dec 31 of 2025) is the offset base so that Jan 1 → day 1.
  2. 2

    Day of year

    floor(15,375,600,000 ÷ 86,400,000) = 177
Results are estimates for general information only and are not professional advice — always verify important results independently before relying on them. Read the full disclaimer.
Quick answer

How does this calculator work?

The day of year is a 1-based count of days from January 1, ending at 365 (or 366 in a leap year). Enter a date as YYYY-MM-DD to get its day number, its ordinal date (YYYY-DDD), and how many days remain in the year. Leap years follow the Gregorian divisible-by-4 rule.

Formula
dayOfYear = floor((date − Date(year, Jan 0)) / 86,400,000); daysRemaining = daysInYear − dayOfYear
How this is calculated

Enter a calendar date in YYYY-MM-DD format. The calculator parses the year, month, and day, then builds a Date object and validates that it round-trips (so impossible dates like February 30 are rejected).

The day-of-year is computed by taking the difference in milliseconds between your date and a reference set to the very start of that year (December 31 of the previous year, expressed as Date(year, 0, 0)), then dividing by 86,400,000 ms per day and flooring. January 1 yields 1. The ordinal date is written as YYYY-DDD, zero-padding the day number to three digits.

The number of days in the year is 366 for leap years and 365 otherwise, using the Gregorian rule: a year is a leap year if divisible by 4, except century years which must be divisible by 400. Days remaining is simply daysInYear minus the day-of-year, so December 31 leaves 0 days remaining. Calculations use the local time zone, and dates near daylight-saving transitions are unaffected because the reference point shares the same year and offset behavior.

Frequently asked questions

January 1 is day 1. The ordinal day-of-year is 1-based, so a non-leap year runs from day 1 to day 365 and a leap year from day 1 to day 366.

An ordinal date (ISO 8601 format YYYY-DDD) identifies a day by its year and its day-of-year number, for example 2026-178, instead of by month and day.

A year is a leap year if it is divisible by 4, except for century years (divisible by 100) which must also be divisible by 400. So 2000 was a leap year but 1900 was not.

Also known as

day of year
ordinal date
julian day of year
what day number
days remaining in year
day number of year
nth day of year
yearly day count

APA

TG we-Calculate Editorial Team. (2026). Day of Year (Ordinal Date) [Online calculator]. TG we-Calculate. https://we-calculate.com/calculator/day-of-year

Chicago

TG we-Calculate Editorial Team. "Day of Year (Ordinal Date)." TG we-Calculate. 2026. https://we-calculate.com/calculator/day-of-year.

IEEE

TG we-Calculate Editorial Team, "Day of Year (Ordinal Date)," TG we-Calculate, 2026. [Online]. Available: https://we-calculate.com/calculator/day-of-year

BibTeX

@misc{wecalculate_day_of_year, title = {Day of Year (Ordinal Date)}, author = {{TG we-Calculate Editorial Team}}, howpublished = {\url{https://we-calculate.com/calculator/day-of-year}}, year = {2026}, note = {TG we-Calculate} }

Did this calculator help you?