I have a sheet with a column of unix epoch times (in seconds): 1500598288
How can I convert these into normal dates?
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))
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)
now, 3 years later from the original post, you can make...
Tools > Script Editor... >
function millisToDate(timeInMillis){
var yourDateFromMillis = new Date(timeInMillis);
return yourDateFromMillis;
}
and use your new function in the cell...
=millisToDate(cell here)