Convert Unix Epoch Time to Date in Google Sheets

I have a sheet with a column of unix epoch times (in seconds): 1500598288

How can I convert these into normal dates?


Solution 1:

The simplest way, not requiring any JS programming, would be through a formula, dividing by 86400 seconds per day and adding to January 1, 1970. For example the following gives 21 July 2017:

=1500598288/86400+date(1970,1,1)

To convert a whole column of numbers, just use ARRAYFORMULA:

=arrayformula(A:A/86400+date(1970,1,1))

Solution 2:

Make a custom function using the javascript Date function:

Tools > Script Editor... >

function FROM_UNIX_EPOCH(epoch_in_secs) {
  return new Date(epoch_in_secs * 1000);  // Convert to milliseconds
}

And then in a new column you can do =FROM_UNIX_EPOCH(A1)