liveBook · Manning

Julian day number

As explained in Object-Oriented Software Design in C++

A Julian day number is a numeric count of days elapsed since noon on January 1, 4713 BCE, in the Gregorian calendar, with fractional values representing times between noons.

A Julian day number identifies a day by counting elapsed days since noon on January 1, 4713 BCE, in the Gregorian calendar. Values are whole at noon; fractional values represent times between noons. Adding or subtracting days then becomes simple arithmetic. section 5.3.2

Use the term carefully:

  • Do not confuse Julian day numbers with the Julian calendar or Julian dates such as 2024-001. section 5.3.2
  • Convert between Julian numbers and Gregorian year-month-day values with dedicated algorithms. section 5.3.2
  • Keep the number private inside Date when it serves as an implementation detail. section 5.3.2

Date arithmetic

A Date object can calculate date2.days_from(date1), add the resulting count to date1, and recover date2. The tester reports 578 days between September 2, 2025 and April 3, 2027; Julian day number 2,440,000 corresponds to May 23, 1968.

How Object-Oriented Software Design in C++ covers it

How deep it goes
Defines the count and applies it inside Date, but defers the complicated Gregorian conversion algorithms.
Examples
Demonstrates day differences, date addition, September 2, 2025, April 3, 2027, and the 1968 conversion milestone.
What it assumes
Assumes Gregorian year-month-day dates and teaches the alternative numeric representation from that starting point.
What you can do after
Apply it via a Date class to calculate day differences and add days efficiently.
How it connects
Connects date arithmetic, Gregorian calendar conversion, class encapsulation, Julian calendar, and Julian date terminology.

Also explained in

Compare how 2 books explain julian day number →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Object-Oriented Software Design in C++. The section links point to the parts of the book it draws on.