Intermediate

Ordinal Date Converter

Convert any calendar date to its ISO 8601 ordinal form YYYY-DDD, or turn a day-of-year number back into a calendar date.

Direction

Choose which way to convert
Enter the date as YYYY-MM-DD
Ordinal date
2026-06-27 = 2026-178
001 — Jan 1365 — Dec 31Day 178Day 178 of 365
Ordinal date
2026-178
Calendar date
2026-06-27
Day of year
178
Days remaining
187
Leap year?
No
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 ordinal date format YYYY-DDD labels a day by its number within the year, from 001 (January 1) to 365 or 366 (December 31). This converter computes that number by counting whole days from the year start, applies the Gregorian leap-year rule, and converts in both directions while showing days remaining.

Formula
DDD = floor((UTC(Y, M, D) − UTC(Y, Jan 0)) / 86400000); leap year if Y%4==0 and (Y%100≠0 or Y%400==0)
How this is calculated

An ordinal date (ISO 8601 calendar-ordinal form) names a day by its year and its sequential number within that year, written YYYY-DDD where DDD runs from 001 to 365, or 366 in a leap year. January 1 is day 001 and December 31 is day 365 or 366.

To convert a calendar date to ordinal form, the tool takes the UTC timestamp of the date and subtracts the UTC timestamp of "day 0" of that year (Date.UTC(Y,0,0), which is the previous December 31). Dividing the millisecond difference by 86,400,000 (the number of milliseconds in a day) and flooring it yields the day-of-year number, which is then zero-padded to three digits. The reverse conversion starts at January 1 and adds DDD−1 days using new Date(Date.UTC(Y, 0, DDD)), then reads back the month and day. Using UTC throughout avoids daylight-saving and time-zone offsets that could shift the day boundary.

Leap years are detected with the Gregorian rule: a year is a leap year when it is divisible by 4, except centuries, which must be divisible by 400. This sets the maximum valid DDD (365 or 366) and the days-remaining count, computed as total days minus DDD. Inputs are validated so impossible dates (such as February 30) and out-of-range day numbers are rejected and a warning is shown.

Frequently asked questions

Not exactly. The ISO ordinal date (YYYY-DDD) is sometimes loosely called a "Julian date" in computing, but the true astronomical Julian Date is a continuous day count since 4713 BC. This tool produces the ISO day-of-year form.

A common year has 365 days (DDD up to 365) and a leap year has 366 days (DDD up to 366). The converter checks the Gregorian leap-year rule to set the valid range.

Using UTC ensures the day-of-year calculation is not affected by local time zones or daylight-saving transitions, which could otherwise push a date onto the wrong calendar day.

Also known as

ordinal date
day of year converter
yyyy-ddd
julian calendar date
day number of year
convert ordinal date
ordinal to calendar date

APA

TG we-Calculate Editorial Team. (2026). Ordinal Date Converter [Online calculator]. TG we-Calculate. https://we-calculate.com/calculator/ordinal-date-converter

Chicago

TG we-Calculate Editorial Team. "Ordinal Date Converter." TG we-Calculate. 2026. https://we-calculate.com/calculator/ordinal-date-converter.

IEEE

TG we-Calculate Editorial Team, "Ordinal Date Converter," TG we-Calculate, 2026. [Online]. Available: https://we-calculate.com/calculator/ordinal-date-converter

BibTeX

@misc{wecalculate_ordinal_date_converter, title = {Ordinal Date Converter}, author = {{TG we-Calculate Editorial Team}}, howpublished = {\url{https://we-calculate.com/calculator/ordinal-date-converter}}, year = {2026}, note = {TG we-Calculate} }

Did this calculator help you?