How to Convert Epoch Time to a Date in Excel

Epoch (Unix) time is a widely used system in programming, databases, and APIs to represent specific moments as the total number of seconds since January 1, 1970, 00:00:00 UTC. While this numeric format is efficient for computers, it’s not human-friendly when you’re analyzing or reporting data in Excel. To make these timestamps meaningful, you’ll need to convert them into readable date and time values. Excel stores dates as serial numbers by counting days from January 1, 1900, so the conversion process involves transforming seconds into days and adjusting for Excel’s date base.

In this article, you’ll learn several reliable techniques whether your timestamps are in seconds or milliseconds, require only dates, need timezone adjustments, or even VBA automation. Let’s begin.

Key Takeaways

Steps to convert epoch time to date in Excel:

➤ Put epoch seconds in A2.
➤ In B2, enter: = TEXT( (A2 / 86400) + DATE(1970,1,1), “yyyy-mm-dd hh:mm:ss” )
➤ Press Enter and copy down.

overview image

Download Practice Workbook
1

Converting Unix Seconds to an Excel Date Using Division and DATE Function

Unix epoch seconds are common in data exports from APIs, logs, or databases but unreadable in Excel. To make them usable for reporting or analysis, convert these raw seconds into Excel’s date format. Since Excel tracks days from January 1, 1900, you first divide the epoch value by 86,400 (seconds in a day) to get days, then add Excel’s reference date for the Unix epoch. This quick, universally compatible method ensures timestamps display correctly for tasks like payroll, scheduling, or auditing.

We’ll use the following dataset:

Converting Unix Seconds to an Excel Date Using Division and DATE Function

Steps:

➤ Put the epoch seconds in A2.
➤ In B2, enter:

= (A2 / 86400) + DATE(1970,1,1)

➤ Press Enter.

Converting Unix Seconds to an Excel Date Using Division and DATE Function

➤ Format B2 as a date/time by pressing  Ctrl  +  1  >> Go to Custom >> Type dd/mm/yyyy hh:mm:ss (or your preferred format) and hit OK.

Converting Unix Seconds to an Excel Date Using Division and DATE Function

➤ Drag down to apply for all rows.

Converting Unix Seconds to an Excel Date Using Division and DATE Function

Notes:
Using =A2/86400+25569 works as well (25569 = days between 1900-01-01 and 1970-01-01), but DATE(1970,1,1) is clearer and consistent across different Excel date systems.


2

Formatting Epoch Conversion as Readable Text with the TEXT Function

Sometimes you need a date-time value stored as plain text which is perfect for CSV exports, concatenating into labels, or sharing without relying on Excel’s cell formatting. Instead of adjusting cell formats, you can wrap your conversion formula in the TEXT function to directly return a neatly formatted string. This approach keeps your output consistent across different systems or when pasting into applications that don’t preserve Excel’s formatting.

Steps:

➤ Put epoch seconds in A2.
➤ In B2, enter:

= TEXT( (A2 / 86400) + DATE(1970,1,1), "yyyy-mm-dd hh:mm:ss" )

➤ Press Enter and copy down.

Formatting Epoch Conversion as Readable Text with the TEXT Function

Use this method whenever you need a fixed, human-readable timestamp, but keep in mind that the result is plain text and can’t be used in further date calculations.


3

Extracting Only the Calendar Date with INT Function

In many reporting or payroll scenarios, you might only need the date itself without any hours or minutes cluttering your spreadsheet. By using the INT function, you strip away the fractional part of the converted value (which represents the time of day) and keep only the whole-number date portion. This is especially handy when summarizing events by day, grouping records in PivotTables, or creating daily logs where the exact time isn’t important.

Steps:

➤ Put epoch seconds in A2.
➤ Format B2 as a date/time by pressing  Ctrl  +  1 Â >> Go to Custom >> Type dd/mm/yyyy hh:mm:ss (or your preferred format) and hit OK.

Extracting Only the Calendar Date with INT Function

➤ In B2, enter this formula:

= INT(A2 / 86400) + DATE(1970,1,1)

➤ Copy down using AutoFill handle.

Extracting Only the Calendar Date with INT Function

This returns midnight (UTC) for that day. Use the non-INT version if you need to include hours and minutes.


4

Handling Millisecond Timestamps (API / Telemetry Data)

Some APIs, telemetry systems, and IoT platforms output epoch timestamps in milliseconds instead of seconds. These values are 1,000 times larger than standard Unix seconds, so using the regular formula without adjustment would give wildly incorrect results. To convert properly, either divide by 1,000 first (to get seconds) or divide directly by 86,400,000 (milliseconds in a day) before adding Excel’s base date. This ensures accurate conversions when working with high-resolution time data, such as sensor readings, transaction logs, or detailed performance metrics.

This is the dataset we will be using:

Handling Millisecond Timestamps (API / Telemetry Data)

Steps:

➤ If milliseconds are in A2, in B2 enter either:

= A2 / 86400000 + DATE(1970,1,1)

➤ Format B2 as a date/time by pressing  Ctrl  +  1  >> Go to Custom >> Type dd/mm/yyyy hh:mm:ss (or your preferred format) and hit OK.

Handling Millisecond Timestamps (API / Telemetry Data)

➤ Drag down.

Tip: Be sure to know whether your epoch value is seconds or milliseconds because using the wrong divisor will produce very wrong dates.


5

Adjusting Converted Times for Time Zone or Local Offset

Epoch timestamps are usually in UTC, but many applications require local time. Converting without adjusting for your time zone can cause errors in reporting or analysis. This method shows how to shift epoch seconds by adding or subtracting the fraction of a day for your time zone, giving accurate local times. Note that daylight saving time (DST) isn’t handled automatically and requires extra adjustment.

Steps:

➤ Put epoch seconds in A2.
➤ Format B2 as a date/time by pressing  Ctrl  +  1  >> Go to Custom >> Type dd/mm/yyyy hh:mm:ss (or your preferred format) and hit OK.

Adjusting Converted Times for Time Zone or Local Offset

➤ To convert to local time (e.g., UTC+2), use:

= (A2 / 86400) + DATE(1970,1,1) + (2/24)

Adjusting Converted Times for Time Zone or Local Offset

➤ For UTC−5 (Eastern Standard Time without DST): subtract 5/24:

= (A2 / 86400) + DATE(1970,1,1) - (5/24)

➤ Copy down.

Adjusting Converted Times for Time Zone or Local Offset

Cautions: Daylight saving time (DST) is not handled automatically. For DST you must apply rules manually or use Power Query/VBA with timezone logic.


6

Creating a Reusable VBA UDF to Convert Epoch Values

If you frequently work with epoch timestamps, creating a reusable VBA User Defined Function (UDF) can save time and simplify your workflow. This UDF can handle both seconds and milliseconds, and allows you to apply a time zone offset in a single function call. It’s ideal for converting large datasets or for repeated use without rewriting formulas.

Steps:

➤ Press  Alt  +  F11 Â to open the VBA editor.
➤ Click on Insert >> Module, then paste:

Function EpochToDate(epoch As Double, Optional isMilliseconds As Boolean = False, Optional offsetHours As Double = 0) As Date
    ' If epoch is in milliseconds, convert to seconds
    If isMilliseconds Then
        epoch = epoch / 1000
    End If
    ' Convert epoch seconds to Excel date and apply optional timezone offset
    EpochToDate = DateAdd("s", epoch + (offsetHours * 3600), #1/1/1970#)
End Function

Creating a Reusable VBA UDF to Convert Epoch Values

➤ Close the editor.
➤ In Excel, use this formula to convert seconds into UTC date/time:

=EpochToDate(A2)

➤ Press Enter and drag down using AutoFill.

Creating a Reusable VBA UDF to Convert Epoch Values

Notes:
UDF returns an Excel Date that you can format. For bulk processing, Power Query is usually faster than cell-by-cell UDF calls.


Frequently Asked Questions

What is epoch time, and why is it used?

Epoch time is the count of seconds since January 1, 1970, 00:00:00 UTC. It provides a universal, time-zone-independent way to represent dates, making it popular for APIs, databases, and programming environments.

How do I convert epoch time in seconds to a date in Excel?

Divide the epoch value by 86,400 (seconds per day) and add DATE(1970,1,1) or 25569. Then format the result as a date. For example: =(A2/86400)+DATE(1970,1,1) produces the proper date-time.

Can Excel handle epoch times in milliseconds?

Yes. Since milliseconds are thousandths of a second, divide the value by 86,400,000 instead of 86,400 before adding DATE(1970,1,1). Format the resulting cell as a date-time to display the readable value.

Why does my converted date look incorrect in Excel?

Incorrect results often occur due to the wrong time unit (milliseconds vs. seconds), using the wrong date base, or not formatting the cell as a date. Double-check your formula and ensure the correct formatting.

Is there a way to automate conversions for large datasets?

Yes. Use Excel formulas for quick conversions or create a VBA macro for automated processing across large datasets. VBA can process thousands of rows and instantly convert Unix timestamps into readable dates and times.


Wrapping Up

In this tutorial, you explored multiple methods to convert epoch (Unix) time into readable date and time values in Excel. You learned how to work with basic formulas, handle milliseconds, apply custom formatting, adjust for time zones, and even use VBA for automation. By mastering these techniques, you can easily interpret Unix timestamps within your spreadsheets, whether for database exports, API logs, or payroll systems. Feel free to download the practice file and share your feedback.

ExcelInsider Team
We will be happy to hear your thoughts

Leave a reply

Excel Insider
Logo