Sometimes, we want to convert Unix epoch time to date in Google Sheets and JavaScript.
In this article, we’ll look at how to convert Unix epoch time to date in Google Sheets and JavaScript.
How to convert Unix epoch time to date in Google Sheets and JavaScript?
To convert Unix epoch time to date in Google Sheets and JavaScript, we can add a JavaScript function that does the conversion.
We open the script editor with Tools > Script Editor… >
Then we add
function millisToDate(timeInMillis) {
  const yourDateFromMillis = new Date(timeInMillis);
  return yourDateFromMillis;
}
to define the millisToDate function.
In it, we create a Date object from the timeInMillis parameter.
timeInMillis is the Unix timestamp in milliseconds.
Then we return the Date object.
Conclusion
To convert Unix epoch time to date in Google Sheets and JavaScript, we can add a JavaScript function that does the conversion.
