UnixTimestamp.app

Julian Date to Date: How to Convert Lot Codes and Day Numbers

Converting a Julian date to a date is quick once you know which of three things the number is. A 5-digit code like 25268 on a can or blister pack is a year plus a day of the year. A 7-digit number like 2460944 is an astronomical Julian Day Number. This guide shows how to convert both, in both directions.

Thomas BlackwellPublished ยท 8 min read
Food can lid and medicine carton with stamped Julian date codes linked by an arrow to a calendar with one day highlighted, beside a telescope for the astronomical Julian day
Key takeaways The short version, before the details.
  1. On packaging, a Julian date code is YYDDD or YYYYDDD: the year, then the day of the year from 001 to 366. So 25268 is 25 September 2025.
  2. The astronomical Julian Day Number is a single running count of days since 4713 BC, and each day starts at noon. 2460944 is also 25 September 2025.
  3. From 1 March onward, the same day number falls one day earlier in a leap year. Check the year before you look up the day.

Julian date to date: which format do you have?

People use "Julian date" for three different numbers. Before you convert, count the digits and look at where the number came from.

252685-digit lot code, YYDDD
20252687-digit ordinal date, YYYYDDD
2460944Astronomical Julian Day Number

All three examples point to the same day, 25 September 2025. The first two are ordinal dates: a year and a day count inside that year. The third counts days continuously and has no year in it.

  • Printed on food, drinks, medicine or cosmetics: almost always an ordinal code (YYDDD, YYYYDDD, or a shorter YDDD).
  • In astronomy software, satellite data or a spreadsheet near 2,460,000: a Julian Day Number.
  • In a history text about the Julian calendar: a date in the old calendar that the Gregorian calendar replaced. That is a separate topic, covered in our Gregorian calendar history post.

What is a Julian date code on packaging?

A Julian date code is a production or packing date written as a year plus the number of days since the start of that year. 1 January is day 001, and 31 December is day 365, or 366 in a leap year. Manufacturers like it because the code is short, sorts correctly and needs no month names.

The code usually marks when the product was made or packed, not when it expires. Some brands print it next to a best-by date. Others print only the code, which is why shoppers end up searching for how to read it.

5-digit YYDDD and 7-digit YYYYDDD formats

The 5-digit form splits into a 2-digit year and a 3-digit day:

25Year: 2025
268Day 268 of the year

The 7-digit form, 2025268, writes out the full year and works the same way. You may also see a 4-digit YDDD code such as 5268, which uses only the last digit of the year. That code repeats every ten years, so use the product's age to work out the decade. Letters or digits after the date part usually identify a plant, line or shift and are not part of the date.

Every brand sets its own coding scheme. If the numbers do not fit YYDDD, check the manufacturer's website or contact their customer service before you trust the date.

How to convert a Julian date to a calendar date

Convert a Julian date by hand

  1. Split the code: 25268 becomes year 2025 and day 268.
  2. Check whether the year is a leap year. 2025 is not.
  3. In the month table below, find the last month whose first day is on or before your day number. For a common year, 1 September is day 244 and 1 October is day 274, so day 268 falls in September.
  4. Subtract and add one: 268 minus 244 plus 1 gives 25. The date is 25 September 2025.

Convert Julian dates in Excel, Python and Bash

In Excel or Google Sheets, with a 5-digit code as a number in A1, this works because DATE rolls extra days over into later months:

=DATE(2000+INT(A1/1000),1,MOD(A1,1000))

In Python, the %y and %j format codes read a 2-digit year and a day of the year (see the Python format code reference):

from datetime import datetime

datetime.strptime("25268", "%y%j").date()    # 2025-09-25
datetime.strptime("2025268", "%Y%j").date()  # 2025-09-25

With GNU date on Linux, add the day number minus one to 1 January:

date -d "2025-01-01 +267 days" +%F   # 2025-09-25

How to convert a calendar date to a Julian date

Going the other way, add the day of the month to the day number of the month's first day, minus one. 15 March 2025 is 60 + 15 minus 1 = day 74, so the code is 25074. In 2024, a leap year, the same date is day 75, or 24075.

=TEXT(A1,"yy")&TEXT(A1-DATE(YEAR(A1),1,0),"000")

That Excel formula turns a date in A1 into a YYDDD code. In Python use strftime("%y%j"), and in a shell use date +%y%j.

To skip the arithmetic, enter the date in the Unix timestamp converter, open Show More Results and read the Day of Year row, which ranges from 1 to 366. Put the year in front of it and zero-pad the day to three digits.

Get the day of the year for any datePick a date and copy its Day of Year value Open converter

How do I find the Julian date today?

Today's Julian date code is the current 2-digit year followed by today's day of the year, padded to three digits. For example, 30 September 2026 is day 273 of a common year, so its code is 26273. The 7-digit form is 2026273.

The converter's home page shows a live Day of Year value next to the current timestamp, and the week numbers tool shows today's day of the year, ISO week and the days left in the year. On Linux or macOS, date +%y%j prints today's 5-digit code. Both tools use your device's local date, so a factory in another time zone may already be on the next day.

What is the astronomical Julian day number?

The Julian Day Number (JDN) is a continuous count of days used in astronomy. Day 0 began at noon Universal Time on 1 January 4713 BC in the proleptic Julian calendar. Because the count never resets, the number of days between two events is just a subtraction, with no months, leap years or calendar reforms to handle.

Astronomers start each Julian day at noon rather than midnight, so a whole night of observations falls under one number. The fractional Julian Date (JD) adds the time of day. The day with JDN 2460944 runs from noon UT on 25 September 2025 to noon on the 26th, and midnight at the start of 25 September is JD 2460943.5. The Julian day article on Wikipedia covers the history and related variants such as the Modified Julian Date, which is JD minus 2400000.5.

Julian Day Number formula

For a Gregorian date, integer division (dropping the remainder) gives the JDN in one pass:

a = (14 - month) div 12
y = year + 4800 - a
m = month + 12*a - 3
JDN = day + (153*m + 2) div 5 + 365*y + y div 4 - y div 100 + y div 400 - 32045

For 25 September 2025: a = 0, y = 6825, m = 6, and the sum comes to 2460944. As a check, 1 January 2000 gives 2451545. The U.S. Naval Observatory offers an official Julian date converter if you need to confirm a result.

Convert a Unix timestamp to a Julian date

Unix time and Julian Date both count uniform days of 86,400 seconds from a fixed moment, so the conversion is one line. The Unix epoch, 1970-01-01 00:00 UTC, is JD 2440587.5:

JD = unix_seconds / 86400 + 2440587.5
unix_seconds = (JD - 2440587.5) * 86400

In JavaScript, Date.now() / 86400000 + 2440587.5 gives the current Julian Date, since Date.now() returns milliseconds.

Why do Julian day numbers shift in leap years?

Ordinal codes count days from 1 January, so the extra day, 29 February, pushes every later date up by one. Up to day 59 (28 February), the two kinds of year agree. After that they differ by one:

CodeYear typeCalendar date
24060Leap year 202429 February 2024
25060Common year 20251 March 2025
24268Leap year 202424 September 2024
25268Common year 202525 September 2025

So a lookup chart for one year gives the wrong date for the next if they differ in leap status. Check the year first with the leap year checker, then use the matching column below. The astronomical Julian Day Number does not have this problem: it never restarts, so a leap day is just one more day in the count.

Julian date calendar: day number for each month

This table gives the day of the year for the first of each month. To convert, find the month, add the day of the month and subtract one.

DateCommon yearLeap year
1 January001001
1 February032032
1 March060061
1 April091092
1 May121122
1 June152153
1 July182183
1 August213214
1 September244245
1 October274275
1 November305306
1 December335336
31 December365366

For one specific date, entering it in the converter and reading Day of Year is faster than the table. The week numbers tool is handy when a code needs to be matched to a production week.

Calendar grid with one day highlighted, showing a date converted to its day of the year
Unix timestamp converter

Turn any date into its Julian day of the year

Enter a date or a Unix timestamp, open the extra results and copy the Day of Year value to build a YYDDD code or check one from a label.

Convert a dateRuns in your browser

Frequently asked questions

It is a production or packing date written as a year plus the day of that year, such as 25268 for day 268 of 2025, which is 25 September. It usually shows when the item was made rather than when it expires. Extra letters or digits often identify the plant or production line.

Split it into a 2-digit year and a 3-digit day, so 25268 becomes 2025 and day 268. Check whether the year is a leap year, find the month whose first day is at or before 268, then count on. Day 268 of 2025 is 25 September.

It is the current 2-digit year followed by today's day of the year, padded to three digits. For example, 30 September 2026 is 26273. The converter's home page and the week numbers tool both show today's day of the year, and date +%y%j prints the code in a terminal.

A Julian date on a label is an ordinal date that restarts at 001 every year. A Julian Day Number is an astronomical count of days since noon on 1 January 4713 BC that never restarts, so 25 September 2025 is 2460944. Each Julian day starts at noon Universal Time.

A leap year adds 29 February as day 60, so every later date moves up by one. Day 60 is 1 March in a common year but 29 February in a leap year, and 1 October is day 274 or 275. Always check the year before you convert the day number.