All guides

Excel dates showing as numbers like 45292 — what they mean and how to convert them

Excel stores every date as a count of days from 30 December 1899, with the time of day as the fraction after the point: 45292 is 1 January 2024, and 45292.5 is noon that day. A CSV written from raw cell values keeps the count instead of the date. The count is exact, so the conversion is too — as long as the 1900 quirk is respected.

The arithmetic

Add the number to 30 December 1899 as days and you have the date; multiply the part after the decimal point by 86,400 and you have the seconds since midnight. 45292 is 1 January 2024; 45657 is 31 December 2024; 25569 is 1 January 1970, which is why the number minus 25569, times 86,400, is the same instant in Unix time. Going the other way, the days between 30 December 1899 and your date is the serial number.

Two traps. Excel believes 29 February 1900 existed, so serial numbers below 60 — dates before that imaginary day — are one day short of the real calendar, 60 itself is a day that never happened, and the epoch is 30 December rather than 31 December for the same reason. The query below applies the correction: a serial below 60 is moved up a day, and 60 comes out blank. And workbooks made in Excel for Mac before 2011 may use the 1904 date system, whose counts are 1,462 lower; if every converted date is four years early, that is why.

Why the CSV has numbers in it

A date in Excel is a number wearing a date format, and the format is not part of the value. Anything that writes the raw values — a script reading the cells, a system exporting what it stores, a copy into a cell formatted as General — writes the count. Excel itself writes the formatted text when it saves a CSV, so the numbers usually arrive from somewhere else.

The Excel converter here reads the workbook’s own number formats and writes dates as ISO text (2024-01-31), so a workbook converted on this site does not have the problem. A CSV that already has the numbers needs the arithmetic.

Convert the column here

The SQL page opens, from the button above, with the conversion already written for the sample file: one new column with the date, one with the date and time, and the 1900 correction built in. Download the sample, drop it on the page and run the query to see it work — the last row holds a serial from February 1900 to show the correction. Then drop your own file, replace the table name and the two column names in the query with yours — the names are listed beside the editor — and run it again.

Every value is carried as text and the new columns are written as text too, so the download holds 2024-01-01, not a number reinterpreted by whatever opens it next. A value the conversion cannot count — a date already written as text, or a blank — comes out blank in the new column and unchanged in the old one.

Converting inside Excel instead

If the numbers are in Excel and you only need to see them as dates, select the column and apply a date format; the values are unchanged and the display fixes itself. To get text you can hand to another system, put =TEXT(A2,"yyyy-mm-dd") in a new column and fill it down. Do not save the sheet as CSV while the column is still General: the count is what will be written.

The sample file

invoice_id,issued,paid_at,amount
INV-1001,45292,45293.5,150.00
INV-1002,45323,,89.50
INV-1003,45351,45351.75,32.10
INV-1004,2024-03-15,,410.00
INV-1005,45657,45658.25,55.25
INV-1006,44927,44930,240.00
INV-1007,59.5,60,18.00

Obviously made-up data, small enough to read. Download it and drop it on the tool to see the fix before trying your own file.

Questions

What date is 45292?
1 January 2024: 45,292 days after 30 December 1899. 45292.5 is noon on that day, since the fraction is the time.
Why is every converted date one day off?
If you converted with plain arithmetic, dates before 1 March 1900 are shifted by Excel’s imaginary 29 February 1900; the query here corrects for it. For any other date, check the time zone of whatever displayed the result — a midnight value shown in a zone west of UTC reads as the day before.
What does the part after the decimal point mean?
The time of day, as a fraction of 24 hours: .5 is noon, .75 is 18:00, .25 is 06:00. A whole number is midnight.
Why are some rows blank in the converted column?
Because the original was not a number — a date already written as text, or an empty cell — or it was 60, the 29 February 1900 that never happened. The conversion leaves those blank rather than guess, and the original column is untouched, so nothing is lost.
Every date is about four years too early — why?
The workbook used the 1904 date system, which some older Excel for Mac versions defaulted to. Add 1,462 to each number before converting, or change the epoch in the query to 1 January 1904.
Can I turn dates back into serial numbers?
Yes — the number is the days between 30 December 1899 and the date, plus the fraction of the day for the time. In a spreadsheet, format a date cell as General and the count appears.
Is my file uploaded anywhere?
No. The query that turns serial numbers back into dates runs in a database engine inside this page, against your file on your own machine; there is no server for it to run on.