EPOCHTODATE Google Sheets function

The EPOCHTODATE function in Google Sheets is a powerful tool designed to convert Unix epoch timestamps into standard datetime formats in UTC. Unix epoch time represents the number of seconds that have elapsed since January 1, 1970, and is commonly used in programming and time-sensitive applications. With EPOCHTODATE, users can easily modify and analyze time-related data by obtaining readable datetime formats directly within their spreadsheets.

Syntax

EPOCHTODATE(epoch_timestamp, [is_millis])
  • epoch_timestamp: The Unix epoch timestamp to convert, represented in seconds, milliseconds, or microseconds.
  • is_millis: (Optional) A boolean value indicating whether the epoch_timestamp is in milliseconds. Default is FALSE, which assumes the timestamp is in seconds.

Example #1

EPOCHTODATE(1635638400)
This function converts the Unix timestamp 1635638400 (which corresponds to November 1, 2021) into a readable UTC datetime format. The result will be: 2021-11-01 00:00:00.

Example #2

EPOCHTODATE(1635638400000, TRUE)
Here, the function transforms the Unix timestamp 1635638400000, specified as a millisecond value, into the datetime format. The output will be: 2021-11-01 00:00:00.

Example #3

EPOCHTODATE(1672531199000000, TRUE)
This function call converts the Unix timestamp for the end of the year 2022, given in milliseconds, into a standard UTC datetime format, resulting in: 2022-12-31 23:59:59.

Error handling

  • VALUE! This error indicates that the provided epoch timestamp is not a valid number.
  • ERROR! This occurs if the ‘is_millis’ argument is not a boolean value (TRUE or FALSE).
  • REF! This error appears when the epoch timestamp refers to a cell that doesn’t exist or is improperly referenced.

Conclusion

The EPOCHTODATE function is an essential tool for anyone working with time data in Google Sheets. By converting Unix timestamps into human-readable datetime formats, it enhances data analysis capabilities and ensures users can accurately interpret time-related information. Whether dealing with seconds or milliseconds, this function streamlines the conversion process, making it a valuable addition to any spreadsheet toolkit.

Leave a Reply

Your email address will not be published. Required fields are marked *