How to Convert Excel Time To Unix Time in Excel

Learn multiple Excel methods to convert Excel time to Unix time with step-by-step examples, business scenarios, and expert tips.

excelformulaspreadsheettutorial
11 min read • Last updated: 7/2/2025

How to Convert Excel Time To Unix Time in Excel

Why This Task Matters in Excel

Working with time-stamped data is now part of almost every analytics, reporting, or automation workflow. Customer service systems log ticket events, e-commerce platforms record order milestones, IoT devices stream sensor readings, and websites generate click-stream logs every second. While Excel remains the most accessible tool for exploring and manipulating such data, many of these external systems store and exchange timestamps in Unix or “epoch” time: the number of seconds that have elapsed since 1 January 1970 00:00:00 UTC.

If you regularly export CSV or JSON data that contains epoch timestamps, you must be able to translate them into human-readable date-time values so that Excel’s pivot tables, charts, and formulas can make sense of them. Conversely, you might need to generate Unix timestamps from Excel for APIs, database imports, or scripting languages that insist on epoch time. Without this skill you risk mangling time zones, misinterpreting durations, and making poor decisions based on misaligned time series.

In financial services, traders often download market data feeds that arrive in Unix seconds or milliseconds. Marketing teams ingest Google Analytics raw exports where every hit’s timestamp is epoch-formatted. Manufacturing engineers pull machine logs with Unix times and need to overlay them with maintenance schedules stored natively as Excel datetime values. Across all these scenarios the inability to convert quickly can derail an otherwise straightforward analysis.

Excel is particularly well suited for this conversion because its date-time engine stores every day as an integer and every fraction of a day as the decimal portion. Converting between day-fractions and seconds therefore becomes a matter of simple arithmetic. Combine that with robust functions such as DATE, TIME, and VALUE plus newer dynamic array features, and you can produce scalable, transparent solutions without leaving your spreadsheet. Mastering this task strengthens your overall competence in date arithmetic, improves data-engineering efficiency, and prevents the expensive downstream errors that arise when timestamps drift out of alignment.

Best Excel Approach

The most reliable approach is a straightforward mathematical transformation that subtracts the Unix epoch’s Excel serial date from the Excel serial date-time you already have, then multiplies by the number of seconds in one day (86 400). This avoids volatile functions and works on any modern Excel version (Windows or Mac).

Syntax (Windows, 1900 date system):

=(A1 - DATE(1970,1,1)) * 86400

Where

  • A1 is the cell containing a valid Excel date-time value
  • DATE(1970,1,1) produces the Excel serial for the Unix epoch start
  • 86400 converts days to seconds

Mac users who still operate in the legacy 1904 date system must adjust the base date. The most future-proof formula is therefore:

=(A1 - DATE(1970,1,1) - IF(INFO("system")="mac", 1462, 0)) * 86400

In most modern Mac installations the workbook is already set to the 1900 system, so the first formula typically suffices.

Why this method?

  • Zero dependencies: works in Excel 2007 through Microsoft 365
  • Full transparency: Finance auditors can trace every arithmetic step
  • Array-ready: prepend with “=LET” or spill ranges for thousands of rows

Alternative approaches include Power Query transformations, VBA helper functions, and dynamic arrays that automatically detect the epoch, but for raw speed plus minimal setup, the direct arithmetic method wins.

Parameters and Inputs

  • Source Date-Time (Required): A numeric cell formatted as Date, Time, or Custom. Text strings must be converted with VALUE or DATEVALUE first.
  • Epoch Base (Optional): DATE(1970,1,1). You can override for different epoch systems (e.g., GPS starts 1980-01-06).
  • Seconds per Day (Optional): 86400. If you require Unix milliseconds, multiply by 86 400 000 instead.
  • Date System Offset (Optional): 1462 if your workbook is in the legacy 1904 system. Confirm under File > Options > Advanced > When calculating this workbook.
  • Time-Zone Considerations: All Unix time is defined at UTC. If your Excel stamps are local time you will need to subtract or add your offset (e.g., local – UTC) before applying the formula.
  • Validation: Always check that the source cell truly holds a numeric value. ISNUMBER(A1) should return TRUE. For imported CSV data that arrives as text, wrap with VALUE if ISNUMBER is FALSE.
  • Edge Cases: Leap seconds are ignored in Unix time and in Excel; the conversion is unaffected. Dates before 1 January 1900 cannot be represented in the 1900 system and will error.

Step-by-Step Examples

Example 1: Basic Scenario

Imagine a simple table where cell A2 contains 15 March 2025 14:30 (formatted as Custom “yyyy-mm-dd hh:mm”). You need to feed this timestamp to a REST API that accepts Unix seconds.

  1. Click B2, where you want the Unix time to appear.
  2. Enter:
=(A2 - DATE(1970,1,1)) * 86400
  1. Press Enter. Excel returns 1741972200.
  2. Double-check: Use an online epoch converter or convert back with:
=DATE(1970,1,1) + B2 / 86400

The result should exactly match 15 Mar 2025 14:30.
5. Drag the fill handle down column B to convert every row in your dataset.

Why it works: Excel internally stores 15 Mar 2025 14:30 as 44989.60417. The serial for 1 Jan 1970 is 25569. Subtracting yields 19420.60417 days. Multiplying by 86 400 transforms days into seconds: 19420.60417 × 86 400 = 1 741 972 200.

Troubleshooting tip: If you see something like 1741972200.000000 instead of a neat integer, apply the Number format with zero decimal places.

Example 2: Real-World Application

You oversee an e-commerce platform that exports a daily CSV “orders.csv” with local timestamps in column C (Pacific Time). Your data engineering team wants epoch seconds in Universal Time.

Step-by-step:

  1. Import the CSV with Data > From Text/CSV. Ensure column C is interpreted as a Date/Time.
  2. Insert a new column D titled “UTC”. Because Pacific Time is eight hours behind UTC for standard time (seven for daylight saving), convert to UTC first. Assuming the data is in January:
=C2 + TIME(8,0,0)
  1. In column E titled “Unix”, enter:
=(D2 - DATE(1970,1,1)) * 86400
  1. Confirm two rows to ensure no Daylight Saving offsets are missed. For dates in July alter the additive time to seven hours or use a lookup table of daylight offsets.

Integration: Feed the E column directly to Power Automate or a Python script by saving as CSV. A typical workflow pulls data nightly, so efficiency matters: array formulas let you convert tens of thousands of rows instantly without VBA.

Performance note: Excel can comfortably handle 100 000 rows of this formula, but if you move beyond that, store the numeric result as values (Copy > Paste Special > Values) to avoid recalculation overhead.

Example 3: Advanced Technique

Scenario: You manage sensor logs containing millisecond precision. The dataset has Date (column A) and a millisecond column (column B) that represents the time of day. You need Unix milliseconds.

  1. Combine date with milliseconds by dividing milliseconds by 86 400 000 (milliseconds per day) and adding:
= A2 + (B2 / 86400000)

This produces a full Excel datetime with sub-second accuracy to roughly 0.0001 seconds.

  1. Wrap conversion:
= ((A2 + (B2 / 86400000)) - DATE(1970,1,1)) * 86400000
  1. Because this could produce a number larger than 2^31-1 (the signed 32-bit limit), store the result as Text if you plan to open it in legacy systems that cannot handle 64-bit integers.

Edge cases:

  • Excel’s floating-point precision limits you to about 3 milliseconds granularity. For microseconds or nanoseconds you must switch to Power Query or external scripting.
  • If the workbook uses the 1904 system, subtract 1462 days before multiplying.

Optimization: Wrap the entire formula in LET:

=LET(
 dateTime, A2 + (B2 / 86400000),
 epoch, DATE(1970,1,1),
 (dateTime - epoch) * 86400000
)

This calculates the combination once, speeding up large sheets.

Tips and Best Practices

  1. Always store intermediate UTC conversions in their own column. Mixing local times with Unix times invites silent errors.
  2. Format Unix columns as Number with zero decimals to avoid scientific notation, especially with millisecond values.
  3. Use named ranges like “Epoch” pointing to DATE(1970,1,1). This makes formulas readable and maintainable.
  4. After conversions are final, paste values to freeze results and boost workbook performance.
  5. For repeated tasks, build a Power Query template where you add a Custom Column: Duration.TotalSeconds([DateTime] - #datetime(1970,1,1,0,0,0)). Refreshing is then one click.
  6. Document the time zone assumption inside the sheet with a visible note or cell comment; future users will thank you.

Common Mistakes to Avoid

  1. Treating text as numbers. If an imported column looks like dates but ISNUMBER returns FALSE, the subtraction produces a #VALUE error. Use VALUE or DATEVALUE first.
  2. Forgetting daylight saving adjustments. Unix time is UTC; converting local time without offset leads to multi-hour drift. Keep a look-up table of offsets or use the built-in WEBSERVICE/TEXTJOIN with world-time APIs for automation.
  3. Mac 1904 date misunderstanding. If you open a Windows workbook on an older Mac that defaults to 1904, every date shifts by 1 462 days. Check File > Options > Advanced → Date System before sharing.
  4. Multiplying before subtracting. Writing (A1 * 86400) - ... inflates numbers beyond recognition because the order of operations is wrong. Always subtract first, then multiply.
  5. Using volatile functions like NOW inside thousands of rows. This triggers full recalculation on every keystroke, slowing workbooks. Record a static stamp with Ctrl+; for the date and Ctrl+Shift+; for the time if you only need a snapshot.

Alternative Methods

MethodDescriptionProsCons
Direct Formula(A1 - DATE(1970,1,1))*86400No add-ins, works everywhere, fastRequires manual time-zone handling
Power QueryCustom column with Duration.TotalSecondsGraphical, repeatable refresh, handles data typesSlightly steeper learning curve, Windows-only for full features
VBA UDFFunction Unix(d as Date) Unix = (d - #1/1/1970#) * 86400 End FunctionEncapsulates logic, reusableMacros may be disabled, security prompts
Dynamic Arrays=MAP(A2:A1000, LAMBDA(x, (x - DATE(1970,1,1))*86400))Single elegant formula, auto-extendsRequires Microsoft 365 or Excel 2021
External Script (Power Automate, Python)Convert after exportExcellent for big data, high precisionExtra tooling, leaves Excel context

When speed and simplicity trump everything, the direct formula wins. For ETL pipelines where the same conversion runs daily, Power Query offers hands-free automation. VBA works well in legacy environments free from macro security hurdles. Dynamic arrays provide compactness in modern Excel, while external scripts become essential for sub-millisecond precision or millions of rows.

FAQ

When should I use this approach?

Use the formula method whenever you need a quick, transparent conversion inside an existing Excel model, especially if you share the workbook with colleagues who may not have add-ins or scripting privileges.

Can this work across multiple sheets?

Absolutely. Point the formula to a different worksheet:
=(Sheet2!A2 - DATE(1970,1,1))*86400.
If many sheets share the same logic, store the epoch in a global named range so that each sheet references one central cell.

What are the limitations?

Excel’s floating-point engine offers roughly 15 digits of precision. Unix seconds are fine, but Unix milliseconds beyond the year 2286 will exceed precision. For microseconds or larger datasets exceeding one million rows, use Power Query or external scripts to maintain accuracy and performance.

How do I handle errors?

Wrap with IFERROR:
=IFERROR((A2 - DATE(1970,1,1))*86400, "Invalid Source").
For data validation, conditional formatting can highlight rows where ISNUMBER returns FALSE, allowing rapid correction.

Does this work in older Excel versions?

Yes, any version since Excel 97 supports the arithmetic. However, dynamic arrays and MAP require Microsoft 365/2021. Power Query is available from Excel 2010 with the add-in and native from 2016 onward.

What about performance with large datasets?

Array calculations are lightning fast up to roughly 100 000 rows. Beyond that, consider:

  • Turning off automatic calculation while pasting data (Formulas > Calculation Options > Manual).
  • Converting formulas to values once final.
  • Using Power Query or a database if you exceed 500 000 rows.

Conclusion

Converting Excel date-time values to Unix time is a foundational skill that bridges spreadsheet analysis and modern data platforms. By mastering the simple subtraction-and-multiplication method you gain confidence in handling API integrations, large log files, and cross-platform automation tasks. The techniques covered—basic arithmetic, time-zone adjustments, millisecond precision, and alternative tools—fit neatly into broader Excel proficiency, from pivot analysis to Power Query ETL. Practice the examples, adopt the best practices, and you’ll never be caught off guard when an epoch timestamp lands in your inbox. Happy converting and keep exploring!

We use tracking cookies to understand how you use the product and help us improve it. Please accept cookies to help us improve.