To convert a Unix timestamp to a date, find its unit from the number of digits, then count that many seconds or milliseconds forward from 00:00:00 UTC on 1 January 1970. A 10-digit value such as 1767225600 is in seconds and means 1 January 2026 at 00:00 UTC, while a 13-digit value is in milliseconds, so divide it by 1,000 first. The result is UTC until you pick a time zone. Paste any value into the Unix Timestamp Converter to see it in UTC, your own time zone and any other, or use the Excel, Google Sheets, JavaScript, Python and SQL methods below.
How to convert a Unix timestamp to a date with Zutilium
- Open the Unix Timestamp Converter and keep Timestamp to date selected under Convert.
- Paste your value into Unix timestamp or ISO 8601 date. The box starts with the current time; click in it and that value is selected, so pasting replaces it. Results update as you type.
- Check the line under the box, for example "Read as milliseconds (13 digits)." Values with 11, 12, 14, 15, 17 or 18 digits sit between the usual lengths, so a note shows the other reading with a button to switch. To force a unit, change Unit from Detect from length to Seconds, Milliseconds, Microseconds or Nanoseconds.
- Read the date under Results: UTC (ISO 8601), Your time zone (labeled with your zone's name) and Time zone, a menu for any other zone, followed by RFC 2822 and HTTP dates and the instant in all four units. Use Copy on any row, or Copy all.
- For a column of values, choose List of timestamps and paste up to 2,000 lines. Lines are read one by one, and a line that fails says why in the Error column. Select Copy table or Download CSV.
- To go the other way, choose Date to timestamp and set Date, Time and Time zone.
Check that the detected unit matches what your system writes and that the year makes sense. Everything runs in your browser, so nothing you paste is uploaded.
Seconds or milliseconds? Count the digits
Unix time counts seconds, but many systems store finer units. For present-day dates, the length gives the unit away:
| Digits | Unit | 2026-01-01 00:00 UTC | To get seconds |
|---|---|---|---|
| 10 | Seconds | 1767225600 | Use as is |
| 13 | Milliseconds | 1767225600000 | Divide by 1,000 |
| 16 | Microseconds | 1767225600000000 | Divide by 1,000,000 |
| 19 | Nanoseconds | 1767225600000000000 | Divide by 1,000,000,000 |
The rule holds from 9 September 2001, when seconds reached 1,000,000,000, until 20 November 2286, when they pass 9,999,999,999. Values from the 1990s are a digit shorter: 9 for seconds, 12 for milliseconds.
Where each unit usually comes from:
- Seconds:
date +%son Linux and macOS, Python'stime.time()(with a decimal fraction), MySQL'sUNIX_TIMESTAMP(), PostgreSQL'sEXTRACT(EPOCH FROM ...), and theexp,iatandnbfclaims in a JWT. - Milliseconds: JavaScript's
Date.now()andgetTime(), and Java'sSystem.currentTimeMillis(). - Nanoseconds: Python's
time.time_ns().
Comparing a JWT's exp in seconds with Date.now() in milliseconds is a classic bug; the JWT Expiry Checker and the guide to checking whether a JWT is expired cover it.
Unix time in milliseconds to a date
Divide by 1,000 and treat the result as seconds, or use a function that accepts milliseconds:
| Where | Milliseconds to date |
|---|---|
| JavaScript | new Date(ms) |
| Python | datetime.fromtimestamp(ms / 1000, tz=timezone.utc) |
| Excel | =A2/86400000+DATE(1970,1,1) |
| Google Sheets | =EPOCHTODATE(A2,2) |
| SQLite | datetime(ms / 1000.0, 'unixepoch') |
UTC versus local time
A Unix timestamp has no time zone. It counts from one fixed moment, so the same number names the same instant everywhere. You need a zone only when you turn it into a calendar date and clock time, and the date itself can change:
| Time zone | 1767225600 shows as | UTC offset |
|---|---|---|
| UTC | 2026-01-01 00:00 | +00:00 |
| New York | 2025-12-31 19:00 | -05:00 |
| Los Angeles | 2025-12-31 16:00 | -08:00 |
| Berlin | 2026-01-01 01:00 | +01:00 |
| Kolkata | 2026-01-01 05:30 | +05:30 |
| Tokyo | 2026-01-01 09:00 | +09:00 |
In New York this New Year timestamp still falls in 2025, so a daily report grouped by UTC date and one grouped by local date disagree around midnight. Store and calculate in UTC, and convert to a named zone such as America/New_York only for display. Named zones apply daylight saving for each date and fixed offsets do not: New York is -05:00 in January but -04:00 in July. To line up working hours across cities, use the Time Zone Meeting Planner or read how to schedule a meeting across time zones.
Convert a Unix timestamp in Excel and Google Sheets
Spreadsheets store a date as a count of days, with the time of day as a fraction. Every Unix day is exactly 86,400 seconds, so divide by 86,400 and add the date value of 1 January 1970:
| Value in A2 | Formula |
|---|---|
| Seconds | =A2/86400+DATE(1970,1,1) |
| Milliseconds | =A2/86400000+DATE(1970,1,1) |
| Seconds and milliseconds mixed | =IF(A2<1E11,A2/86400,A2/86400000)+DATE(1970,1,1) |
The mixed formula treats anything below 100,000,000,000 as seconds, which is right for seconds before the year 5138 and milliseconds after 3 March 1973. If a cell shows a number such as 46023 instead of a date, press Ctrl+1, choose Custom in the Category list and type yyyy-mm-dd hh:mm:ss in the Type box, adding .000 to show milliseconds. With 1767225600 in A2, the seconds formula then shows 2026-01-01 00:00:00, and 1767225600123 in the milliseconds formula shows 2026-01-01 00:00:00.123.
The result is UTC. For another zone, add or subtract its offset as a fraction of a day: =A2/86400+DATE(1970,1,1)-5/24 gives 2025-12-31 19:00:00 for New York. A fixed offset does not follow daylight saving, so it is wrong for part of the year wherever clocks change; New York needs -4/24 between March and November. To turn a UTC date in A2 back into seconds, use =ROUND((A2-DATE(1970,1,1))*86400,0); ROUND clears floating-point leftovers.
Google Sheets accepts the same formulas, because it also counts days from 30 December 1899. It adds EPOCHTODATE: =EPOCHTODATE(A2) for seconds, =EPOCHTODATE(A2,2) for milliseconds and =EPOCHTODATE(A2,3) for microseconds. According to Google's EPOCHTODATE reference, the result is in UTC rather than the spreadsheet's time zone, and negative timestamps are not accepted, so use the formula for dates before 1970.
Two Excel details cause most wrong answers:
- Use
DATE(1970,1,1), not 25569. Both mean 1 January 1970 in the default 1900 date system, but workbooks from early versions of Excel for Mac can use the 1904 date system, where a typed 25569 lands 4 years and 1 day late. DATE follows the workbook's setting. - Long values lose digits. Excel keeps 15 significant digits, so a 19-digit nanosecond value is stored with zeros at the end. The date is still right to the millisecond, but the original number is gone. Import such columns as text, as in keeping long IDs intact in Excel, then convert the first 13 digits with
=VALUE(LEFT(A2,13))/86400000+DATE(1970,1,1).
Epoch to date in JavaScript, Python and SQL
The examples use 1767225600 (1 January 2026, 00:00 UTC) and its millisecond form.
JavaScript
const seconds = 1767225600;
const date = new Date(seconds * 1000); // Date takes milliseconds
console.log(date.toISOString());
// 2026-01-01T00:00:00.000Z
console.log(date.toLocaleString("en-US", { timeZone: "America/New_York" }));
// 12/31/2025, 7:00:00 PM
console.log(new Date(1767225600123).toISOString()); // milliseconds go in unchanged
// 2026-01-01T00:00:00.123Z
A Date holds milliseconds since the epoch, and MDN's Date reference notes that leap seconds are ignored. toISOString() always prints UTC, while toLocaleString() without a timeZone uses the computer's zone. A JavaScript number is exact only up to 9,007,199,254,740,991, so Number("1767225600123456789") and JSON.parse both turn a 19-digit nanosecond value into 1767225600123456800. Use BigInt instead:
const ns = 1767225600123456789n; // BigInt keeps all 19 digits
console.log(new Date(Number(ns / 1_000_000n)).toISOString());
// 2026-01-01T00:00:00.123Z
To read 19-digit values in an API response without rounding, paste the response into the JSON Formatter & Validator, which keeps number literals exactly as written.
Python
from datetime import datetime, timedelta, timezone
from zoneinfo import ZoneInfo
utc = datetime.fromtimestamp(1767225600, tz=timezone.utc)
print(utc) # 2026-01-01 00:00:00+00:00
print(utc.astimezone(ZoneInfo("America/New_York"))) # 2025-12-31 19:00:00-05:00
ms = 1767225600123
epoch = datetime(1970, 1, 1, tzinfo=timezone.utc)
print(epoch + timedelta(milliseconds=ms)) # 2026-01-01 00:00:00.123000+00:00
Always pass tz. Without it, fromtimestamp() returns the computer's local time as a naive datetime, and utcfromtimestamp() has been deprecated since Python 3.12 (datetime documentation). The same page warns that fromtimestamp() relies on the platform's C library, often limited to 1970 through 2038, so adding a timedelta to the epoch is safer for old or distant dates.
datetime stops at microseconds, so nanosecond values lose their last three digits. On Windows, zoneinfo needs the tzdata package. For a pandas column, pd.to_datetime(df["ts"], unit="ms", utc=True) converts every value.
SQL
-- PostgreSQL: to_timestamp() takes seconds and returns timestamptz
SELECT to_timestamp(1767225600) AT TIME ZONE 'UTC'; -- 2026-01-01 00:00:00
SELECT to_timestamp(1767225600) AT TIME ZONE 'America/New_York'; -- 2025-12-31 19:00:00
-- MySQL: FROM_UNIXTIME() answers in the session time zone
SET time_zone = '+00:00';
SELECT FROM_UNIXTIME(1767225600); -- 2026-01-01 00:00:00
SELECT FROM_UNIXTIME(1767225600123 / 1000); -- 2026-01-01 00:00:00.1230
-- SQLite
SELECT datetime(1767225600, 'unixepoch'); -- 2026-01-01 00:00:00
SELECT strftime('%Y-%m-%d %H:%M:%f', 1767225600123 / 1000.0, 'unixepoch');
-- 2026-01-01 00:00:00.123
Without AT TIME ZONE, PostgreSQL displays the result in the session's TimeZone setting (PostgreSQL date/time functions). MySQL's FROM_UNIXTIME always answers in the session time zone, so set it before converting. In SQLite, divide milliseconds by 1000.0 rather than 1000, because integer division drops the milliseconds, and milliseconds passed straight to 'unixepoch' return NULL.
Command line
date -u -r 1767225600 '+%Y-%m-%d %H:%M:%S' # macOS: 2026-01-01 00:00:00
date -u -d @1767225600 '+%Y-%m-%d %H:%M:%S' # Linux (GNU date): 2026-01-01 00:00:00
Leave out -u to see your local time instead. For PHP, Java, C#, Go or Ruby, choose the language under Language in the converter and select Copy code.
The year 2038 problem
A signed 32-bit integer counts up to 2,147,483,647, which as Unix time is 03:14:07 UTC on 19 January 2038. One second later the counter wraps to -2,147,483,648, which reads as 20:45:52 UTC on 13 December 1901. Systems that keep time in 64 bits are not affected, but 32-bit limits survive in a few places:
- Database columns. MySQL's
TIMESTAMPtype ends at 2038-01-19 03:14:07 UTC, according to the MySQL manual, and a signedINTcolumn of seconds overflows at the same moment. UseDATETIMEorBIGINTinstead. - SQL Server's DATEADD. In SQL Server 2022 and earlier its number argument is an
int, soDATEADD(SECOND, ts, '1970-01-01')fails with an arithmetic overflow after 2038, and adding milliseconds fails for any present-day value. SQL Server 2025 accepts abigint, according to the DATEADD reference. In the converter, choose SQL: SQL Server under Language for a version that adds days and milliseconds separately. - Embedded devices and older 32-bit software that still use a 32-bit
time_t.
Other limits worth knowing:
| Limit | Range ends (UTC) |
|---|---|
| Signed 32-bit seconds | 2038-01-19 03:14:07 |
| Unsigned 32-bit seconds | 2106-02-07 06:28:15 |
| Exact microseconds in a JavaScript number | 2255-06-05 23:47:34 |
Excel dates and Python datetime |
9999-12-31 |
JavaScript Date |
275760-09-13 |
| Signed 64-bit seconds | About 292 billion years after 1970 |
The converter flags any value outside the signed 32-bit range in its Unix seconds row, a quick check before you store a date past 2038.
Troubleshooting wrong dates
The date lands in January 1970
Seconds were read as milliseconds: 1767225600 read that way is 1970-01-21 10:53:45.600 UTC. Multiply seconds by 1,000 before passing them to JavaScript's Date. A result of exactly 1970-01-01 00:00 means the value was 0 or empty.
The year is in the tens of thousands, or you get an error
Milliseconds were read as seconds: 1767225600000 seconds is in the year 57971. Excel fills the cell with ##### because the date is past 31 December 9999, its last supported date. SQLite returns NULL, and many libraries raise an out-of-range error. Divide by 1,000.
The time is off by whole hours
One step produced UTC and another expected local time. Python's fromtimestamp() without tz returns the computer's local time and MySQL's FROM_UNIXTIME() the session time zone, while spreadsheet formulas and toISOString() return UTC, so convert to local time once, at the end. If the error is one hour for only part of the year, a fixed offset is ignoring daylight saving; use a named zone such as America/New_York.
Excel shows 1.76723E+12 instead of the number
Excel's General format shows numbers of 12 or more digits in scientific notation. The cell still holds the full value, so formulas work, but copying the displayed text loses digits: 1.76723E+12 is about 73 minutes away from 1767225600123. Format the column as Number with no decimal places before copying. A date exactly 4 years and 1 day late is the 1904 date system problem described above.
The number is not Unix time
Windows file times, also used by Active Directory attributes such as lastLogonTimestamp, count 100-nanosecond intervals since 1 January 1601 UTC. Present-day values have 18 digits and read as a date in 1974 when treated as nanoseconds. Divide by 10,000,000 and subtract 11,644,473,600 to get Unix seconds. A five-digit number such as 46023 is a spreadsheet date, not a timestamp.
Frequently asked questions
What is the Unix epoch?
The Unix epoch is 00:00:00 UTC on 1 January 1970, the moment Unix time counts from. Timestamp 0 is that instant, positive values come after it and negative values before it. "Epoch time" usually means Unix time.
Is a Unix timestamp in UTC or local time?
It is based on UTC: it counts seconds from midnight UTC on 1 January 1970, so the number is identical in every time zone. The zone matters only when you display it as a date, which is why 1767225600 is New Year's Day in London and New Year's Eve in New York.
Does Unix time count leap seconds?
No. Unix time treats every day as exactly 86,400 seconds, so the leap second at the end of 2016 has no timestamp: 1483228799 is 2016-12-31 23:59:59 UTC and 1483228800 is 2017-01-01 00:00:00 UTC. That fixed day length keeps the divide-by-86,400 spreadsheet formulas exact.
How do I get the current Unix timestamp?
Use Math.floor(Date.now() / 1000) in JavaScript, int(time.time()) in Python or date +%s on Linux and macOS; all three return seconds. The converter's Current Unix time panel shows the live value in seconds and milliseconds, each with a Copy button.
Can a Unix timestamp be negative?
Yes. Negative values count back from 1970, so -86400 is 1969-12-31 00:00:00 UTC. Most languages accept them, but Google Sheets' EPOCHTODATE rejects them and Excel cannot show dates before 1900.