Date arithmetic
The calculation of dates and intervals by adding, subtracting, or otherwise manipulating time values.
Software Design for Python Programmers
Date arithmetic is the calculation of dates by adding or subtracting time intervals and determining differences between dates.
- How it is used
- Supports Date objects that add intervals and calculate signed differences while hiding their internal representation.
- How deep it goes
- Descends from calendar rules to loop-based stepping and Julian-number internals, while exposing conversion costs and implementation tradeoffs.
- Examples
- Uses September 2, 2025, April 3, 2027, loop-based stepping, and Julian-number addition and subtraction.
- What you can do after
- Build it from scratch in a Python Date class using calendar-aware stepping or Julian-number arithmetic.
Read how Software Design for Python Programmers explains date arithmetic →
Object-Oriented Software Design in C++
Date arithmetic is the computation of dates and intervals by adding, subtracting, or otherwise manipulating calendar-day values.
- How it is used
- Uses date arithmetic to implement Date operations for advancing dates and measuring intervals.
- How deep it goes
- Compares loop-based and Julian-number implementations, including performance costs and representation conversions.
- Examples
- Demonstrates September 2, 2025 to April 3, 2027, yielding 578 days and the matching destination date.
- What you can do after
- Evaluate loop-based and Julian-number implementations and recognize their distinct performance costs.
Read how Object-Oriented Software Design in C++ explains date arithmetic →
Related concepts
- julian day numberaddressed by · A Julian day number is a continuous count of days since noon on January 1, 4713 BCE, in the Julian calendar, optionally including a fractional part for the time of day.
These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.

