How to convert between date and Unix timestamp in Excel?

Unix timestamp is also called Epoch time or POSIX time which is wildly used in many operating systems or file formats. This tutorial is talking about the conversion between date and Unix timestamp in Excel.

Convert date to timestamp

Convert date and time to timestamp

Convert timestamp to date

More tutorials about datetime conversion...


arrow blue right bubble Convert date to timestamp

To convert date to timestamp, a formula can work it out.

Select a blank cell, suppose Cell C2, and type this formula =(C2-DATE(1970,1,1))*86400 into it and press Enter key, if you need, you can apply a range with this formula by dragging the autofill handle. Now a range of date cells have been converted to Unix timestamps.
doc-convert-date-unix-1


Remove Time From DateTime

In Excel, to remove 12:11:31 from 1/21/2017 12:11:31 and make it exactly 1/21/2017, you may have to take some time to create a formula to handle this job. However, the Remove time from date utility of Kutools for Excel can quickly remove timestamp permanently from the date time formatting in Excel.
Click to download 30-day free trial.

doc-convert-date-unix-1

arrow blue right bubble Convert date and time to timestamp

There is a formula that can help you convert date and time to Unix timestamp.

1. Firstly, you need to type the Coordinated Universal Time into a cell, 1/1/1970. See screenshot:
doc-convert-date-unix-2

2. Then type this formula =(A1-$C$1)*86400 into a cell, press Enter key, then if you need, drag the autofill handle to a range with this formula. See screenshot:
doc-convert-date-unix-3

Tips: In the formula, A1 is the date and time cell, C1 is the coordinate universal time you typed.


arrow blue right bubble Convert timestamp to date

If you have a list of timestamp needed to convert to date, you can do as below steps:

1. In a blank cell next to your timestamp list and type this formula =(((A1/60)/60)/24)+DATE(1970,1,1), press Enter key, then drag the auto fill handle to a range you need.
doc-convert-date-unix-4

2. Then right click the cells used the formula, and select Format Cells from the context menu, then in the popping Format Cells dialog, under Number tab, click Date in the Category list, then select the date type in the right section.
doc-convert-date-unix-5

3. Click OK, now you can see the Unix timestamps have been converted to dates.
doc-convert-date-unix-6

Notes:

1. A1 indicates the timestamp cell you need.

2. This formula also can use to convert timestamp series to date and time, just format the result to the date and time format.

Tip: If you are in trouble with remembering complex formulas, here the Auto Text tool of Kutools for Excel can save all formulas you used in a pane for you, then, you can reuse them in anywhere anytime, what you only need to do is change the references to match your real need.  Click for free download it now.
doc-convert-date-unix-6


Relative Articles:

  • How to remove time from date in Excel?
    If there has a column of date with time stamp, such as 2/17/2012 12:23, and you don’t want to retain the time stamp and want to remove the time 12:23 from the date and only leave the date 2/17/2012. How could you quickly remove time from date in mulitple cells in Excel?

  • How to combine date and time into one cell in Excel?
    There are two columns in a worksheet, one is the date, the other is time. Is there any way to quickly combine these two columns into one, and keep the time format? Now, This article introduces two ways in Excel to combine date column and time column into one and keep the time format.


The Best Office Productivity Tools

Kutools for Excel Solves Most of Your Problems, and Increases Your Productivity by 80%

  • Reuse: Quickly insert complex formulas, charts and anything that you have used before; Encrypt Cells with password; Create Mailing List and send emails...
  • Super Formula Bar (easily edit multiple lines of text and formula); Reading Layout (easily read and edit large numbers of cells); Paste to Filtered Range...
  • Merge Cells/Rows/Columns without losing Data; Split Cells Content; Combine Duplicate Rows/Columns... Prevent Duplicate Cells; Compare Ranges...
  • Select Duplicate or Unique Rows; Select Blank Rows (all cells are empty); Super Find and Fuzzy Find in Many Workbooks; Random Select...
  • Exact Copy Multiple Cells without changing formula reference; Auto Create References to Multiple Sheets; Insert Bullets, Check Boxes and more...
  • Extract Text, Add Text, Remove by Position, Remove Space; Create and Print Paging Subtotals; Convert Between Cells Content and Comments...
  • Super Filter (save and apply filter schemes to other sheets); Advanced Sort by month/week/day, frequency and more; Special Filter by bold, italic...
  • Combine Workbooks and WorkSheets; Merge Tables based on key columns; Split Data into Multiple Sheets; Batch Convert xls, xlsx and PDF...
  • More than 300 powerful features. Supports Office/Excel 2007-2019 and 365. Supports all languages. Easy deploying in your enterprise or organization. Full features 30-day free trial. 60-day money back guarantee.
kte tab 201905

Office Tab Brings Tabbed interface to Office, and Make Your Work Much Easier

  • Enable tabbed editing and reading in Word, Excel, PowerPoint, Publisher, Access, Visio and Project.
  • Open and create multiple documents in new tabs of the same window, rather than in new windows.
  • Increases your productivity by 50%, and reduces hundreds of mouse clicks for you every day!
officetab bottom
Say something here...
symbols left.
You are guest ( Sign Up? )
or post as a guest, but your post won't be published automatically.
Loading comment... The comment will be refreshed after 00:00.
  • To post as a guest, your comment is unpublished.
    gundppa · 22 days ago
    how to convert event time stamp to hour

  • To post as a guest, your comment is unpublished.
    Krebs · 1 months ago
    To convert date for MOODLE the only formula that worked was:


    Instead of =(C2-DATE(1970,1,1))*86400

    I tried 20/october/1980 and Moodle read 19/october/1980.

    I used
    =(C2-DATE(1970,1,0))*86400

    I tried 20/october/1980 and Moodle read 20/october/1980.



  • To post as a guest, your comment is unpublished.
    sharon · 4 months ago
    How to convert 21 digits timestamp to human readable date ?
    Could someone help please
    E.g., 202002191100506253230
  • To post as a guest, your comment is unpublished.
    Dan Miller · 10 months ago
    IF you have an LDAP 18-Digit timestamp such as 132079258679926000 the below formulas will not work. You first have to convert them as they are based in nano seconds from 1/1/1601. The following formula in Excel converts the LDAP to EPOCH to human dates =(((((A1/10000000)-11644473900)/60)/60)/24)+DATE(1970,1,1) where A1 refers to your timestamp location
    • To post as a guest, your comment is unpublished.
      Sunny · 7 months ago
      Thanks for your supplement.
  • To post as a guest, your comment is unpublished.
    m.fullen87@gmail.com · 2 years ago
    One thing to note is that the above is for epoch time in seconds. If you need milliseconds, you need to add a further multiplication / division by 1000. For example, converting from epoch time (milliseconds) to a date would be "=((((A1/1000)/60)/60)/24)+DATE(1970,1,1)".
    • To post as a guest, your comment is unpublished.
      m.fullen87@gmail.com · 2 years ago
      As a side note, the best way to tell if it's seconds or milliseconds is looking at the length of the field; if it's 10 digits, it's seconds, and if it's 13 digits, it's milliseconds. "=LEN(A1)" will tell you how long the value is.
      • To post as a guest, your comment is unpublished.
        m.fullen87@gmail.com · 2 years ago
        If that's too much manual work for you (or you have a list that's mixed between seconds and milliseconds), then you can use the following formula to automatically switch between seconds and milliseconds based on the length of the cell: "=((A1/86400)/IF(LEN(A1)=13,1000,1))+DATE(1970,1,1)".
  • To post as a guest, your comment is unpublished.
    Lilian · 2 years ago
    I followed your instructions here, but I get ########## in my excel file. I formatted it to date time. Any suggestions?
    • To post as a guest, your comment is unpublished.
      Boe · 2 years ago
      Had the same problem, but I figured it out. The cell has to have number format, not date format...
    • To post as a guest, your comment is unpublished.
      fuad · 2 years ago
      yeah me too, I got the same problem
      • To post as a guest, your comment is unpublished.
        Sunny · 2 years ago
        Which formula you use?
    • To post as a guest, your comment is unpublished.
      The Slenderman · 2 years ago
      Normally you see ########## if there's too much information to display for how big you have your cells. Enlarge your cell size and see if that resolves the issue.
    • To post as a guest, your comment is unpublished.
      Sunny · 2 years ago
      Excuse me, could you tell me which part did not work in your file? Could you upload the detail screenshot for me to have a look?
      • To post as a guest, your comment is unpublished.
        Scott Miller · 2 years ago
        Goggle for "excel convert timestamp to date". Google, grabbing the first answer which is for date to timestamp, gives the answer of "=(A1-DATE(1970,1,1))*86400", which is what Sunny was probably doing. Only if you actually read the content of this page does it become obvious that the actual formula should be something else. To keep the time portion of the timestamp, the formula should be this for UTC "=(A1+DATE(1970,1,1)*86400)/86400". For US Central time, "=(F2+DATE(1970,1,1)*86400-21600)/86400"
        • To post as a guest, your comment is unpublished.
          Sunny · 2 years ago
          Thank u for you suppelment.
  • To post as a guest, your comment is unpublished.
    Andrey · 3 years ago
    Thank you!

    (Your comment is too short! - it was responce to my first line, so I just add this junk :P )
    • To post as a guest, your comment is unpublished.
      VAS · 2 years ago
      Using =(((((G2/1000)/60)/60)-8)/24)+DATE(1970,1,1) for PST