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.
Ordinal date: 2026-177
- 1
Elapsed milliseconds
date − Jan 0 of 2026 = 15,375,600,000Jan 0 (Dec 31 of 2025) is the offset base so that Jan 1 → day 1. - 2
Day of year
floor(15,375,600,000 ÷ 86,400,000) = 177
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
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
TG we-Calculate Editorial Team. (2026). Day of Year (Ordinal Date) [Online calculator]. TG we-Calculate. https://we-calculate.com/calculator/day-of-year
TG we-Calculate Editorial Team. "Day of Year (Ordinal Date)." TG we-Calculate. 2026. https://we-calculate.com/calculator/day-of-year.
TG we-Calculate Editorial Team, "Day of Year (Ordinal Date)," TG we-Calculate, 2026. [Online]. Available: https://we-calculate.com/calculator/day-of-year
@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?
