Spreadsheet dates are often stored as serial numbers so formulas can add days, subtract dates and calculate intervals. The displayed date is formatting layered on top of that numeric value.
The 1900 system
The common Excel date system counts forward from an early-1900 epoch and preserves a historical compatibility quirk around serial 60. That quirk matters when building a date converter.
The 1904 system
Some older workbook environments use a different starting point. Moving raw serials between the two systems without accounting for the epoch creates a large date shift.
Fractional days represent time
A decimal portion of a serial represents part of a day. For example, half a day represents twelve hours. Formatting determines whether you see the number, a date, a time or both.