Excel Serial Date Converter
The number a date cell shows when its format is set to General. The fraction is the time of day.
Date to Excel serial number
For writing a value back into a sheet or a formula.
Unix timestamp to Excel date
Seconds since 1970, as logs and APIs hand them over.
Formulas to paste into a sheet
Format the result cell as a date afterwards, or it will display as a plain number.
The number behind a spreadsheet date, turned into something readable, including the dates Excel gets wrong on purpose.
How Excel stores a date
As a number of days. 1 is 1 January 1900, 25569 is 1 January 1970, and a date in 2024 is somewhere around 45,000. The time of day is the fraction: .5 is noon and .75 is six in the evening. Formatting only changes how the number is displayed, which is why a date cell switched to General turns into a five-digit number, and why dates exported to CSV so often arrive that way.
Converting between Excel dates and Unix timestamps
Unix time counts seconds from 1 January 1970; Excel counts days from 1900. So the whole conversion is a division and an offset:
- =A1/86400+25569 turns Unix seconds into an Excel date
- =A1/86400000+25569 does the same for milliseconds
- =(A1-25569)*86400 turns an Excel date back into Unix seconds
Format the result as a date, or it displays as a number. And remember what Excel will not tell you: a Unix timestamp is UTC, while the resulting cell has no timezone at all. If you want local time in the sheet, add or subtract the offset as a fraction of a day, such as +10/24 for Sydney in winter.
The 1900 leap year bug
1900 was not a leap year, because century years are only leap years when divisible by 400. Lotus 1-2-3 treated it as one anyway, and Excel copied the mistake so that spreadsheets moving between the two would keep their dates. So serial 60 is 29 February 1900, a day that never existed, and every serial from 1 to 59 is one day earlier than straightforward arithmetic from the real epoch would suggest. Google Sheets and LibreOffice avoid the bug by starting their count on 30 December 1899, which means they agree with Excel on every date from 1 March 1900 and disagree by a day on every date before it.
1900 against 1904: dates four years out
Early Mac versions of Excel counted from 1 January 1904 instead, sidestepping the leap year problem at the cost of a second, incompatible system. The same serial number lands 1,462 days later under 1904. Modern Excel defaults to 1900 on both platforms, but the setting travels with the workbook, so an old Mac file or a template made from one still carries it. When copied dates come out almost exactly four years wrong, this is nearly always the reason, and adding or subtracting 1462 fixes it.
Excel dates in Python, pandas, JavaScript and C#
Serial dates usually turn up in code after a CSV export or an Excel file read by a script. Every recipe below counts from 30 December 1899, which absorbs the leap year bug and matches Excel from 1 March 1900 onwards. For a workbook in the 1904 system, add 1462 to the serial first. Each was checked against this converter using 45321.75, which is 30 January 2024 at 18:00.
- To date
- datetime(1899, 12, 30) + timedelta(days=serial)
- To serial
- (dt - datetime(1899, 12, 30)) / timedelta(days=1)
- To date
- pd.to_datetime(df["col"], unit="D", origin="1899-12-30")
- To serial
- (s - pd.Timestamp("1899-12-30")) / pd.Timedelta(days=1)
- To date
- new Date(Math.round((serial - 25569) * 86400000))
- To serial
- date.getTime() / 86400000 + 25569
- To date
- DateTime.FromOADate(serial)
- To serial
- dt.ToOADate()
Python and pandas give a time with no zone, like Excel itself. JavaScript reads the serial as UTC, so display the result with its UTC methods or it shifts by your local offset.
Excel date FAQs
What is an Excel serial date?
The number Excel actually stores for a date. It counts days, so 45321 is a day in January 2024, and the fraction is the time of day: 45321.5 is noon, 45321.75 is six in the evening. Set a date cell to General format and this is what you see.
How do I convert a Unix timestamp to a date in Excel?
Use =A1/86400+25569 and format the cell as a date. Dividing by 86,400 turns seconds into days, and 25569 is the serial number of 1 January 1970, the Unix epoch. For milliseconds divide by 86,400,000 instead. Going the other way, =(A1-25569)*86400 turns an Excel date back into Unix seconds.
How do I convert an Excel serial date in Python?
Add the serial as a number of days to 30 December 1899: datetime(1899, 12, 30) + timedelta(days=serial). In pandas, pd.to_datetime(df["col"], unit="D", origin="1899-12-30") converts a whole column at once. The 1899 origin is deliberate: it absorbs the 1900 leap year bug, so the result matches Excel for every date from 1 March 1900 onwards. For a workbook using the 1904 system, add 1462 to the serial first.
Why does Excel think 29 February 1900 exists?
Because Lotus 1-2-3 did. Lotus treated 1900 as a leap year, which it was not, and Microsoft kept the error so spreadsheets moved between the two would not shift by a day. The result is that serial 60 is a date that never happened, and every serial from 1 to 59 is a day away from where honest arithmetic would put it.
What is the 1904 date system?
A second counting scheme, starting on 1 January 1904, that early Mac versions of Excel used. The same serial number means a date four years and a day later in 1904 than in 1900. Copying cells between workbooks using different systems shifts every date by 1,462 days, which is the usual cause of dates that are mysteriously four years out.
Do Google Sheets and Excel use the same serial numbers?
For every date from 1 March 1900 onwards, yes. Before that they differ by a day, because Sheets and LibreOffice count from 30 December 1899 without inventing a 29 February. It almost never matters for real data, which is exactly why it catches people out when it does.
What timezone is an Excel date in?
None. A serial is a calendar date and a clock reading with no zone attached, so 45321.75 is six in the evening on whatever clock the person typing it was looking at. If the values came from a system log in UTC they are UTC; if someone in Sydney typed them in they are Sydney time. The spreadsheet cannot tell you which.
Is anything I paste sent to a server?
No. The conversion runs entirely in your browser and the page works offline.