Please Note: This article is written for users of the following Microsoft Excel versions: 97, 2000, 2002, and 2003. If you are using a later version (Excel 2007 or later), this tip may not work for you. For a version of this tip written specifically for later versions of Excel, click here: Converting UNIX Date/Time Stamps.

Converting UNIX Date/Time Stamps

by Allen Wyatt
(last updated October 22, 2015)

When you import information created by other computer programs, you may run into a situation where your data includes a date/time stamp created by UNIX. Once imported, you are then faced with the challenge of converting the date/time stamp to an Excel date/time format. Doing the conversion is rather easy, once you understand how both systems save their time.

Time stamps in UNIX are stored as an integer value representing the number of seconds since 1 January 1970. Further, time stamps are stored in GMT time, meaning there has been no adjustment to the stamp to reflect time zones or time-zone variations (such as Daylight Savings Time).

Excel, on the other hand, stores time stamps as a real number representing the number of days since 1 January 1900 (the default setting). The integer portion of the time stamp represents the number of full days, while the portion of the time stamp to the right of the decimal point represents the fractional portion of a day, which can be converted to hours, minutes, and seconds.

To do a straight conversion of a UNIX time stamp to the Excel system, all you need to do is use this formula:

```=UnixTime / 86400 + 25569
```

In this example, UnixTime can be either a named cell containing the integer UNIX time stamp value, or it can be replaced with the actual integer value. Since the UNIX time stamp is stored as seconds, the division by 86400 is necessary to convert to days, which is used by Excel. (86400 is the number of seconds in a day.) You then add 25569, which is the number of days between 1 January 1900 and 1 January 1970. (It is the value returned if you use the =DATE(1970,1,1) function.)

Remember, that this does a straight conversion. You may still need to adjust for time zones. If the UNIX system recorded something occurring at 5:00 pm local time, you need to determine how many hours difference there is between you and GMT. If there happens to be four hours, then you need to adjust your conversion formula accordingly, as shown here:

```=UnixTime / 86400 + 25569 - 4 / 24
```

If you are unsure of how your time zone relates to GMT, you can find the needed information here:

```http://tycho.usno.navy.mil/zones.html
```

ExcelTips is your source for cost-effective Microsoft Excel training. This tip (2051) applies to Microsoft Excel 97, 2000, 2002, and 2003. You can find a version of this tip for the ribbon interface of Excel (Excel 2007 and later) here: Converting UNIX Date/Time Stamps.

Author Bio

Allen Wyatt

With more than 50 non-fiction books and numerous magazine articles to his credit, Allen Wyatt is an internationally recognized author. He  is president of Sharon Parq Associates, a computer and publishing services company. ...

MORE FROM ALLEN

Sharing AutoText Entries

AutoText entries can make your writing more productive, if used effectively. Because of this, it can be advantageous for all ...

Discover More

Character Limits for Cells

Excel places limits on how much information you can enter into a cell and how much of that information it will display. This ...

Discover More

Including Footnotes and Endnotes in Word Counts

When you have Word calculate how many words there are in a document, it normally doesn't pay attention to text in footnotes ...

Discover More

Save Time and Supercharge Excel! Automate virtually any routine task and save yourself hours, days, maybe even weeks. Then, learn how to make Excel do things you thought were simply impossible! Mastering advanced Excel macros has never been easier. Check out Excel 2010 VBA and Macros today!

Converting Mainframe Date Formats

Different industries and different computer systems specify dates in all sorts of strange ways. If you need to convert a date ...

Discover More

Converting Phone Numbers

Sometimes you receive a phone number that contains alphabetic characters and you need to convert it to a purely numeric phone ...

Discover More

Automatically Converting to GMT

You know what time it is, right? (Quick—look at your watch.) What if you want to know what time it is in Greenwich, ...

Discover More
Subscribe

FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."

If you would like to add an image to your comment (not an avatar, but an image to help in making the point of your comment), include the characters [{fig}] in your comment text. Youâ€™ll be prompted to upload your image when you submit the comment. Images larger than 600px wide or 1000px tall will be reduced. Up to three images may be included in a comment. All images are subject to review. Commenting privileges may be curtailed if inappropriate images are posted.

What is 3 - 0?

2013-09-17 03:14:47

Igor

This information helped me a lot. Thanks!

Regards, Igor from Ukraine (Kiev)

This Site

Got a version of Excel that uses the menu interface (Excel 97, Excel 2000, Excel 2002, or Excel 2003)? This site is for you! If you use a later version of Excel, visit our ExcelTips site focusing on the ribbon interface.