Find the day number within the year for any date

Count a date’s one-based position within its Gregorian year.

freeworks offlinenothing uploaded
ToolDay of Year
Input
Output
Put this on your own site

The frame below runs the same code as this page, in the reader's own browser. Nothing is sent to us, and nothing is sent to you.

Pick a dark background and the text and panels follow it, so the frame stays readable on a dark page.

Preview

How it works

UTC midnight for the selected date is subtracted from UTC midnight on 1 January, divided by 86,400,000 milliseconds, and increased by one. Remaining days subtract that ordinal from 365 or 366 under the Gregorian leap rule.

  • Counting begins at one, so 1 January is day 1.
  • UTC arithmetic prevents a 23- or 25-hour daylight-saving day from changing the ordinal.

Worked example

Find the day number within the year for any date
Find which day of the year March 15 is
Input
											2025-03-15
										
Output
												Date: 2025-03-15
Day of Year: 74 / 365
Days Remaining: 291
Year Progress: 20.27%
Leap Year: No
											

When to use this

Ordinal-date records encode values such as 2024-060, seasonal datasets index annual observations, and maintenance logs compare milestones without month names.

Edge cases

  • 31 December is day 366 in a leap year but day 365 in a common year.
  • A local timestamp near midnight is reduced to the parsed UTC calendar date.
  • An invalid date string is rejected rather than normalized into another month.

References