
Guides
Part of Should the holiday calendar live in a spreadsheet or a service?
How dates survive or break moving between Excel, Google Sheets and APIs
Date serials, the 1900 and 1904 epochs 1,462 days apart, text dates, Google Sheets locale and time zone, and API formats, with worked values you can check in a sheet.
A date moved between a spreadsheet and an interface is judged by one test: does the value arrive meaning the same day? Most failures are not arithmetic. A serial is read against the wrong epoch, a text date is parsed under the wrong locale, or a moment is trimmed to a date in the wrong zone. This page sets out how each tool stores a date, the values to check by hand, and the formats that travel safely.
What to take away
- A spreadsheet date is a number. The whole part is the day and the fraction is the time of day. 5 March 2027 at noon is 46451.5 on the Excel 1900 system.
- Excel has two date systems, and Microsoft documents that the 1900 serial is always 1,462 days higher than the 1904 serial for the same date. The stored number 46388 is 1 January 2027 in one and 2 January 2031 in the other.
- Google Sheets counts from 30 December 1899, which agrees with Excel's 1900 system from 1 March 1900 onward.
- A text date such as
03/04/2027is 4 March or 3 April depending on locale. The two serials are 30 days apart. - Editorial suggestionsend
2027-03-05over an API, never the raw serial. A bare number on the wire carries no epoch.
What the number means
Microsoft states that by default 1 January 1900 is serial number 1. Google's Sheets API describes its serial number format as days since 30 December 1899, with the time of day as the decimal part, so noon on 1 January 1900 is 2.5. The openpyxl source converts a time to a fraction of a day by dividing seconds by 86,400.
These values can be checked in any sheet by typing the date and formatting the cell as a number.
| Date | Excel 1900 system | Excel 1904 system | Days since 1970-01-01 |
|---|---|---|---|
| 1 January 2027 | 46388 | 44926 | 20819 |
| 1 March 2027 | 46447 | 44985 | 20878 |
| 5 March 2027 at 12:00 | 46451.5 | 44989.5 | 20882.5 |
Expression / Returns for 46451.5
INT(A2)- 46451, the date part
MOD(A2,1)- 0.5, noon
B2-A2- Whole days between two date cells
(B2-A2)*24- Elapsed hours between two timestamps
Subtracting two serials is exact and carries no zone, so a clock change cannot move the answer. The count between dates is built from the same idea in the days-between-dates formula, and the Excel subtraction itself is in counting days between dates in Excel.
The 1900 and 1904 systems
Microsoft documents the 1900 system as the default in Excel for Windows, Excel 2016 for Mac and Excel for Mac 2011, with the 1904 system the default in earlier versions of Excel for Mac. Its worked example is 5 July 2011: serial 40729 in the 1900 system and 39267 in the 1904 system, a gap of 1,462 days, which Microsoft describes as four years and one day including a leap day.
Copy raw numbers from a 1900 workbook into a 1904 workbook and every date shifts by that gap. Microsoft says dates copied from a workbook in the other system are converted automatically unless the "Automatically convert date system" option is turned off, in which case Excel asks whether to convert them. Editorial suggestion: a bare number moved through a CSV file or a script has no such conversion attached, so state the date system next to it.
Editorial suggestion: confirm which system a workbook uses by typing a known date and reading its serial. 1 January 2027 should show 46388 in the 1900 system and 44926 in the 1904 system.
The 1900 leap-year defect
Lotus 1-2-3 treated 1900 as a leap year, and Microsoft kept that for compatibility. Its troubleshooting note says the only practical consequence is that WEEKDAY returns wrong values for dates before 1 March 1900, and that other leap years, including 2100, are handled correctly.
The effect on serials is that serial 60 is a date that never existed, 29 February 1900. Google's serial format treats 1900 as not a leap year, and its epoch of 30 December 1899 is what makes the two systems agree from 1 March 1900, which is serial 61 in both. Treat serials as interchangeable only from that date. The openpyxl documentation says it matches Excel for January and February 1900 except 29 February 1900, which cannot be a Python datetime, and advises against using it for dates before 1900.
Text dates
A text date looks like a date but is not one. It sorts alphabetically, it is invisible to date functions, and it converts on entry by locale. Microsoft's NETWORKDAYS page says text dates can cause problems and that an invalid date returns #VALUE!. Its DATEVALUE page warns that the computer's system date setting may change the result.
Worked values: 03/04/2027 read month-first is 4 March 2027, serial 46450. Read day-first it is 3 April 2027, serial 46480. A column with a day above 12 parses one way, which is why the damage looks intermittent. Editorial suggestion: import in ISO order, YYYY-MM-DD, which has no day-versus-month ambiguity, then test the column with a numeric check such as ISNUMBER rather than by eye. A closure range that contains a text date is the failure Microsoft's NETWORKDAYS page warns about. The workday formulas that depend on a clean range are in country calendars in Excel.
Google Sheets settings
In Google Sheets, locale and time zone are set under File, then Settings, then General. Google says changing them alters the spreadsheet's default currency, date and number formatting. The Sheets API exposes both as spreadsheet properties: locale as a language code such as en or en_US, and timeZone in CLDR format such as America/New_York.
Google's pages for TODAY and NOW describe them as volatile functions. TODAY returns the current date and NOW the current date and time, and each shows the value from the last time the spreadsheet was recalculated. Those pages do not say which time zone they use. Editorial suggestion: test it rather than assume. Set the file time zone to one where it is already the next day, and compare =TODAY() with the date on your clock.
Google's DATEVALUE page says the formats it recognises are those Sheets would convert if typed into a cell, and that they may depend on region and language settings. Type an example into an empty cell to check that a format is understood. Editorial suggestion: treat a typed date as a plain number with no zone, and confirm that by changing the file time zone and checking that it does not move. Record the file's locale and time zone near the top of the sheet.
Imports and API formatting
The Sheets API gives two controls. Writing with valueInputOption set to RAW stores the input exactly as given. USER_ENTERED treats it as if typed into the interface, and strings may be converted to numbers or dates under the same rules. A date string written with USER_ENTERED therefore inherits the locale problem above.
Reading, the date-time render option decides the shape: SERIAL_NUMBER returns a double counting days from 30 December 1899, and FORMATTED_STRING returns text in the spreadsheet's number format and locale. Neither is a self-describing date. For a stable text value, build it in a cell with =TEXT(A1,"yyyy-mm-dd") and read the result as text.
On the wire, use the ISO shapes in RFC 3339: a plain date as 2027-03-05, and a moment with a Z or numeric offset. The sheet-versus-service decision and the shared parity cases are in where the holiday calendar should live.
Python: pandas and openpyxl
The pandas to_datetime documentation describes an origin argument whose default is 1970-01-01 and which accepts any date that can be converted to a timestamp, used with unit='D' for day counts. It does not mention Excel serials. The conversion is therefore derived, not documented there: count days from 1899-12-30 and a serial from March 1900 onward lands on the right date. By the definition above, 46388 gives 1 January 2027, and the same number with an origin of 1904-01-01 gives 2 January 2031. Leaving the default origin treats the number as days since 1970.
openpyxl handles the workbook side. Its documentation describes the 1900 default and the 1904 option through workbook.epoch, says Excel date formats have no time zone support so only naive datetimes are written, and offers an option to store dates as ISO 8601 strings. Its source defines the epochs as 30 December 1899 and 1 January 1904 and adjusts values below 60 so that dates before March 1900 match Excel.
Checks before a date crosses
Editorial suggestion, a short routine:
- Type 1 January 2027 and read the serial46388 or 44926 tells you the system.
- Test every populated date cell for a number, not for how it looks.
- Record the file locale and time zone, and import in ISO order.
- Send ISO text on the wire and convert to a serial only inside the sheet.
Sources
- [Microsoft
- Date systems in Excel](https://support.microsoft.com/en-us/office/date-systems-in-excel-e7fe7167-48a9-4b96-bb53-5612a800b487)
- [Microsoft
- Excel incorrectly assumes that the year 1900 is a leap year](https://learn.microsoft.com/en-us/troubleshoot/microsoft-365-apps/excel/wrongly-assumes-1900-is-leap-year)
- [Microsoft
- DATE function](https://support.microsoft.com/en-us/office/date-function-e36c0c8c-4104-49da-ab83-82328b832349)
- [Microsoft
- NETWORKDAYS function](https://support.microsoft.com/en-us/office/networkdays-function-48e717bf-a7a3-495f-969e-5005e3eb18e7)
- [Microsoft
- DATEVALUE function](https://support.microsoft.com/en-us/office/datevalue-function-df8b07d4-7761-4a93-bc33-b7471bbff252)
- Google Docs Editors Help
- Spreadsheet settings
- Google Docs Editors Help
- TODAY
- Google Docs Editors Help
- NOW
- Google Docs Editors Help
- DATEVALUE
- [Google Sheets API
- Spreadsheet properties](https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets)
- [Google Sheets API
- DateTimeRenderOption](https://developers.google.com/sheets/api/reference/rest/v4/DateTimeRenderOption)
- [Google Sheets API
- ValueInputOption](https://developers.google.com/sheets/api/reference/rest/v4/ValueInputOption)
- [pandas documentation
- to_datetime](https://pandas.pydata.org/docs/reference/api/pandas.to_datetime.html)
- [openpyxl documentation
- Dates and times](https://openpyxl.readthedocs.io/en/stable/datetime.html)
- IETF RFC 3339
- Date and time on the Internet







