Skip to content

Day of Year

Find the day number within the year.

Date
Output

No result

About Day of Year

Day of Year tells you which day of the year a given date falls on, counting from the first of January. It is the quick way to answer how far into the year a date is - useful for scheduling, for project milestones expressed as day numbers, and for working out how many days have passed.

Give it a date and it computes the difference between that date and the last day of the previous year, dividing by the number of milliseconds in a day. The answer is written as Day N of YYYY, so the sample date of the fifteenth of June 2024 reads Day 167 of 2024 - the higher number is a reminder that 2024 is a leap year.

The tool leans on the JavaScript date parser for its correctness, which means leap years are handled automatically because the year is taken from the parsed date. A date that cannot be parsed returns the words Invalid date with no further detail, and there is no reverse direction - the day number alone cannot be turned back into a date here.

How to use Day of Year

  1. 1 Enter the date you want to locate within its year.
  2. 2 Run the tool to read the day number and the year.
  3. 3 Check that the result accounts for leap years, as the sample does for 2024.

Frequently asked questions

How is the day number worked out?

The difference between the date and the last day of the previous year is divided by the number of milliseconds in a day, then floored. The sample date of 2024-06-15 gives 167 because 2024 is a leap year.

Does it handle leap years correctly?

Yes. The year is taken from the parsed date and the calculation uses the real calendar, so the higher day count for dates in a leap year such as 2024 comes out correctly.

What does an invalid date return?

The words Invalid date, with no further detail. A missing or blank field behaves the same way, so there is no prompt to fill in a value.

Can I convert a day number back to a date?

No. The tool works in one direction only, from a date to its day number. There is no reverse conversion and no ISO week number or ordinal form such as 167th.

Free, online, and private

Free to use

Day of Year is completely free. There is no account to create, no login, and no hidden charge or usage limit.

Runs online in your browser

It is a free online tool that runs entirely in your browser. Nothing to download or install — open the page and start using it right away.

Your data stays private

All processing happens locally on your device. Your input is never uploaded, stored, or tracked, so it never leaves your browser.

How Day of Year behaves in detail

These are the specifics of this implementation — the exact ranges, defaults and fixed settings you are working with.

Parameter Value
Input one Date field starting at 2024-06-15
Output a single line of the form Day N of YYYY
Formula the difference between the date and the last day of the previous year, divided by the number of milliseconds in a day and floored
Default the sample reads Day 167 of 2024, since 2024 is a leap year
Leap years the year is taken from the parsed date, so a leap year such as 2024 is counted correctly
Invalid input a date that cannot be parsed returns the words Invalid date

Compiled from the implementation of this tool and checked against it by itoolnet.

What Day of Year does not do

Knowing the edges of a tool saves more time than another list of its features. These are the cases where it will not do what you might expect.

  • It only reads a date string. There is no timestamp input, no reverse direction from a day number back to a date, and no ISO week number or ordinal suffix - the answer is the bare day count and the year.
  • An invalid or missing date simply returns Invalid date with no detail, and there is no validation of ranges. A month of thirteen is rejected outright, but a day that overflows its month is not - the thirtieth of February is quietly rolled forward and counted as the first of March instead of being flagged.
  • The leap-year handling is correct only because the JavaScript Date object is used. The output gives no indication of whether the year is a leap year, and there is no option to count from a different starting day.

Tested and documented by itoolnet, the team that builds and maintains this site.

Share & embed this tool

Writing a guide or article? You are welcome to link to Day of Year with the snippet below. It is free, runs entirely in your browser, and needs no signup.