Home › Guides › Dates become numbers
Why your Excel dates turned into numbers like 45366
If a CSV shows 45366 where a date should be, nothing is lost: that number is the date, in the form Excel stores it. Here is how to read it, fix it and avoid it.
Why it happens
Excel stores every date as a serial number: the number of days since December 31, 1899. 45366 is March 15, 2024; 45292 is January 1, 2024. What you see in Excel is that number with a date format applied on top. A converter that copies the stored number and ignores the format writes 45366 into the CSV.
Times are fractions of a day. 0.5 is noon, 0.75 is 6 PM, and 45366.6041666667 is March 15, 2024 at 2:30 PM.
Reading the number
| Number in the CSV | Date or time |
|---|---|
| 1 | January 1, 1900 |
| 36526 | January 1, 2000 |
| 45292 | January 1, 2024 |
| 45366 | March 15, 2024 |
| 46023 | January 1, 2026 |
| 0.5 | 12:00 noon |
| 0.604166666666667 | 2:30 PM |
Files from very old Mac versions of Excel can use the 1904 date system, which counts from January 1, 1904. Their numbers are 1,462 lower for the same date, so dates would come out four years and one day off if read the 1900 way.
Fix it in Excel
- Select the column of numbers.
- Press Ctrl+1 (Cmd+1 on a Mac) to open Format Cells.
- Choose Date and pick a style, then click OK.
The numbers turn back into dates. To get text that keeps its look when saved, use a helper column: =TEXT(A2,"yyyy-mm-dd").
Fix it in Google Sheets
Select the column, then Format › Number › Date. Google Sheets uses the same day count as Excel, so the dates come out right.
Fix it in code
Python with pandas:
import pandas as pd
df["date"] = pd.to_datetime(df["date"], unit="D", origin="1899-12-30")
The origin is December 30, not 31, because Excel wrongly treats 1900 as a leap year; starting a day earlier makes every date after February 1900 come out right. In SQL or other languages, add the number of days to 1899-12-30 the same way.
Avoid it next time
Use a converter that applies Excel's formats. This converter writes dates exactly as Excel shows them by default, or as ISO dates (2024-03-15) if you pick Dates: ISO, which is the best choice for databases and code. Its conversion report tells you how many dates it found in each sheet.
FAQ
Questions
Why does my date show as 45366?
Excel stores dates as the number of days since December 31, 1899. 45366 is March 15, 2024. The CSV got the stored number instead of the formatted date.
How do I convert 45292 to a date?
In Excel or Google Sheets, format the cell as a Date. In Python, use pd.to_datetime(value, unit="D", origin="1899-12-30"). 45292 is January 1, 2024.
Why are my times showing as decimals like 0.604166?
Excel stores times as fractions of a day. 0.604166 is 14.5 hours out of 24, which is 2:30 PM. Format the cell as Time to see it.
How do I stop dates turning into numbers when converting to CSV?
Convert with a tool that applies Excel's number formats, such as xlsxtocsv.com, or format the date column as text in Excel before saving.