which google sheets function is specifically designed to convert a unix epoch timestamp to a regular datetime in the utc timezone?
Which Google Sheets Function Converts Unix Epoch to UTC Datetime?
To convert a Unix epoch timestamp to a regular datetime in Google Sheets, the specifically designed function is EPOCHTODATE().
Quick Example:
=EPOCHTODATE(1672531200) returns 1/1/2023 00:00:00 (UTC).
Table of Contents
- Understanding the EPOCHTODATE Function
- How It Works (Syntax)
- Comparison: New vs. Old Method
- Summary Table
- Frequently Asked Questions
Understanding the EPOCHTODATE Function
Historically, Google Sheets users had to use complex mathematical formulas to convert Unix timestamps. However, Google introduced the EPOCHTODATE() function specifically to simplify this process.
Unix Epoch time is the number of seconds (or milliseconds) that have elapsed since January 1, 1970 (UTC). The EPOCHTODATE function automatically handles the conversion from this integer format into a human-readable datetime format without requiring manual math or timezone offsets.
How It Works (Syntax)
The function follows a simple structure:
=EPOCHTODATE(timestamp, [unit])
- timestamp: The Unix epoch timestamp you want to convert.
- unit (Optional):
1(Default): Seconds.2: Milliseconds.
Pro Tip: If your timestamp has 13 digits (e.g.,
1672531200000), it is in milliseconds. You must set the unit to2or the date will appear incorrectly as a year far in the future.
Comparison: New vs. Old Method
Before this function existed, users relied on the “Math Method.” Here is how they compare:
| Feature | EPOCHTODATE Function |
Math Formula Method |
|---|---|---|
| Formula | =EPOCHTODATE(A1) |
=A1/86400 + DATE(1970,1,1) |
| Complexity | Very Low | Moderate |
| Readability | High (Clear intent) | Low (Hard to audit) |
| Unit Handling | Built-in (Seconds/ms) | Manual division required |
| Timezone | Returns UTC | Returns UTC |
Summary Table
| Key Point | Details |
|---|---|
| Primary Function | EPOCHTODATE() |
| Default Timezone | UTC |
| Input Type | Unix Timestamp (Integer) |
| Output Type | Date / Time Object |
| Legacy Alternative | (Timestamp / 86400) + 25569 |
Frequently Asked Questions
1. Does EPOCHTODATE adjust for my local timezone?
No, the function is specifically designed to return the UTC datetime. If you need a different timezone, you must add or subtract the hour difference manually (e.g., + TIME(3,0,0) for UTC+3).
2. Why does my result look like a random number?
Google Sheets sometimes treats the output as a number. You must go to Format > Number > Date time to display it correctly.
3. Can I convert a date back to a Unix timestamp?
Yes, you can use the reverse function: DATETOEPOCH().
Next Steps
Shall I show you how to adjust the EPOCHTODATE result to your specific local timezone using the TIME function?