A Unix timestamp is the number of seconds that have passed since 00:00:00 UTC on 1 January 1970. That starting moment is called the Unix epoch, so people also call it epoch time. For example, the timestamp 1791158400 means 5 October 2026 at 00:00:00 UTC, which is 5:30 a.m. in India.
Computers like this format because it is just one whole number. It is the same everywhere in the world, it ignores time zones and daylight saving time, and it is easy to add and subtract. This guide shows how to read a timestamp, how to convert it in Excel, Google Sheets, Python, JavaScript, SQL and the command line, and the mistakes that cause real bugs.

- Unix time 0: 1 January 1970, 00:00:00 UTC
- One day: always 86,400 seconds
- October 2026: a little over 1.79 billion
- 10 digits: seconds. 13 digits: milliseconds
- To get India time (IST): add 19,800 seconds (5 hours 30 minutes)
What is a Unix timestamp?
It is a count of seconds from one fixed moment. The POSIX standard, which sets the rules for Unix-like systems, calls it “seconds since the Epoch”. The Linux manual describes the epoch as 1970-01-01 00:00:00 +0000 (UTC). Python’s official documentation says the epoch is the same date “on all platforms”.
Think of it like a stopwatch that started at midnight UTC on 1 January 1970 and has never stopped. Every second, the number goes up by one.
| Unix timestamp | Date and time (UTC) | Same moment in India (IST) |
|---|---|---|
| 0 | 1 Jan 1970, 00:00:00 | 1 Jan 1970, 5:30:00 a.m. |
| 86400 | 2 Jan 1970, 00:00:00 | 2 Jan 1970, 5:30:00 a.m. |
| 1000000000 | 9 Sep 2001, 01:46:40 | 9 Sep 2001, 7:16:40 a.m. |
| 1234567890 | 13 Feb 2009, 23:31:30 | 14 Feb 2009, 5:01:30 a.m. |
| 1791158400 | 5 Oct 2026, 00:00:00 | 5 Oct 2026, 5:30:00 a.m. |
| 1800000000 | 15 Jan 2027, 08:00:00 | 15 Jan 2027, 1:30:00 p.m. |
| 2147483647 | 19 Jan 2038, 03:14:07 | 19 Jan 2038, 8:44:07 a.m. |
| -1 | 31 Dec 1969, 23:59:59 | 1 Jan 1970, 5:29:59 a.m. |
Negative numbers count backwards, so -1 is one second before the epoch. Not every system accepts negative timestamps, so test before you store dates from before 1970.
Why does Unix time start in 1970?
Nothing special happened at that moment. It is simply an agreed starting point, picked when the Unix operating system was young, and a round date made a handy zero. What matters today is that every system agrees on it. POSIX, Linux, Python, JavaScript and MySQL all count from the same moment.
Seconds or milliseconds? Count the digits
A timestamp with 10 digits is almost always in seconds. A timestamp with 13 digits is almost always in milliseconds. Mixing them up is the most common timestamp bug.
Most systems count seconds. JavaScript counts milliseconds. MDN, the Mozilla developer reference, explains that a JavaScript date is the number of milliseconds since the epoch. So the same moment looks like this:
- Seconds (10 digits): 1791158400
- Milliseconds (13 digits): 1791158400000
- Microseconds (16 digits): 1791158400000000

Here is what goes wrong when you mix them. If you give the seconds value 1000000000 to JavaScript, which expects milliseconds, you get 12 January 1970 instead of 9 September 2001. We tested this in Node.js. If a date shows up in 1970, the unit is the first thing to check.
The digit rule works for a long time. Every 10-digit seconds value falls between 9 September 2001 and 20 November 2286.
How to convert a Unix timestamp to a date
Every method below turns 1791158400 into 5 October 2026, 00:00:00 UTC. We ran each code line ourselves, except the Excel and Google Sheets formulas, which follow the rules in Microsoft’s and Google’s own help pages.
In Excel
Put the timestamp in cell A1 and use:
=A1/86400+DATE(1970,1,1)
Then format the cell as a date and time. Excel stores dates as day numbers, and 1 January 1970 is day 25569, so you can also write =A1/86400+25569. For India time, add 5.5 hours: =A1/86400+DATE(1970,1,1)+TIME(5,30,0). For a 13-digit value, divide by 86400000 instead.
This works with Excel’s default “1900 date system”. Microsoft’s help page gives the check: in that system, 5 July 2011 is serial number 40729, and the formula’s day count agrees with it. Older Mac workbooks may use the 1904 system, which shifts every date.
In Google Sheets
=EPOCHTODATE(A1)
Google’s help page says the result is in UTC, not your sheet’s time zone. Add a second value to change the unit: 1 for seconds (the default), 2 for milliseconds, 3 for microseconds. The Excel formula above also works in Sheets.
In Python
from datetime import datetime, timezone
datetime.fromtimestamp(1791158400, tz=timezone.utc)
# 2026-10-05 00:00:00+00:00
Always pass tz=. Without it, Python shows the time in your computer’s local zone, which is a common source of “off by 5 hours 30 minutes” bugs in India.
In JavaScript
new Date(1791158400 * 1000).toISOString()
// "2026-10-05T00:00:00.000Z"
Multiply by 1000 first, because JavaScript wants milliseconds. The result is in ISO 8601 format, and the Z at the end means UTC.
In MySQL
SELECT FROM_UNIXTIME(1791158400);
The MySQL manual says FROM_UNIXTIME shows the result in the session time zone, not always UTC. So the same query can print different times on two servers. Check your session’s time zone setting before you trust the output.
On the Linux or macOS command line
date -u -d @1791158400 # GNU date (Linux)
date -u -r 1791158400 # BSD date (macOS)
We tested the GNU version, which printed Mon Oct 5 00:00:00 UTC 2026. The macOS version uses -r instead of -d @.

How to get the current Unix timestamp
| Where | Code | Unit |
|---|---|---|
| Linux / macOS shell | date +%s | seconds |
| Python | import time; time.time() | seconds (with decimals) |
| JavaScript | Date.now() | milliseconds |
| JavaScript, in seconds | Math.floor(Date.now() / 1000) | seconds |
| MySQL | SELECT UNIX_TIMESTAMP(); | seconds |
How to convert a Unix timestamp to IST
Add 19,800 seconds, then read the result as a normal date. India Standard Time is UTC+5:30, and 5 hours 30 minutes is 19,800 seconds.
Example: 1791158400 is 00:00 UTC on 5 October 2026. Add 19,800 and you get 5:30 a.m. IST on the same day. In Python, pass timezone(timedelta(hours=5, minutes=30)) instead of timezone.utc.
Be careful not to add the offset twice. The timestamp itself never changes with the time zone. Only the way you display it changes. For more on UTC and offsets, read our guide to GMT vs UTC.
Do time zones and daylight saving time change Unix time?
No. A Unix timestamp marks one moment for the whole planet. At the same instant, a server in Mumbai, London and New York all read the same number.
That is why apps store timestamps and convert them only when they show a date to a person. When clocks jump forward or back for daylight saving time, local time skips or repeats an hour, but Unix time keeps counting one second at a time.
Does Unix time count leap seconds?
No. POSIX says that “each and every day” is counted as exactly 86,400 seconds. A real day with a leap second has 86,401, so Unix time simply has no number for the extra second.
The last leap second came at the end of 31 December 2016. According to the International Earth Rotation and Reference Systems Service (IERS), UTC has been 37 seconds behind atomic time (TAI) since 1 January 2017. The moment 23:59:60 UTC that night has no Unix timestamp of its own: 1483228799 is 23:59:59, and the next value, 1483228800, is midnight. The IERS Bulletin C of July 2026 says no leap second will be added at the end of December 2026.
Because every day is 86,400 seconds, you can turn days into seconds with simple multiplication. Our page on how many seconds are in a day shows the working.
What is the Year 2038 problem?
Old systems that store Unix time as a signed 32-bit number run out of room at 03:14:07 UTC on 19 January 2038 (8:44:07 a.m. IST). The biggest value they can hold is 2,147,483,647.
One second later, the number overflows. On many such systems it wraps around to -2,147,483,648, which reads as 13 December 1901. The Linux manual warns that a program with a 32-bit time value cannot show the time from 2038-01-19 03:14:08 UTC onwards, and it advises using a wider type.

Most modern computers and phones already use 64-bit time, which lasts far longer than anyone needs. The risk sits in old embedded devices, old file formats and database columns that still use 32 bits. The MySQL manual, for example, lists a limit of 2038-01-19 03:14:07 UTC for its Unix timestamp functions on 32-bit platforms. On 64-bit platforms the limit is 3001-01-18 23:59:59 UTC.
Why exactly 2,147,483,647? It is 231 − 1, the largest number a signed 32-bit value can store. You can see how signed numbers work with our decimal to signed binary converter.
Unix timestamps in Discord
Discord can show a time in each reader’s own time zone. Type the timestamp in this pattern:
<t:1791158400:F>
Discord’s developer documentation says the number must be in seconds. The letter at the end picks the style:
| Letter | Style |
|---|---|
| t | Short time |
| T | Medium time (with seconds) |
| d | Short date |
| D | Long date |
| f | Long date, short time (the default) |
| F | Full date with weekday, short time |
| s | Short date, short time |
| S | Short date, medium time |
| R | Relative, such as “in 3 days” |
Common Unix timestamp mistakes
- Mixing seconds and milliseconds. A date in 1970, or one thousands of years ahead, usually means this. Count the digits.
- Forgetting the time zone when you display it. Python and MySQL can use local time by default. Say which zone you want.
- Adding the IST offset to the stored number. Store the plain timestamp. Add +5:30 only when you show it.
- Storing it in a 32-bit column. It breaks in January 2038. Use a 64-bit type.
- Expecting leap seconds. Unix time skips them, so it is not a perfect count of real elapsed seconds across 2016.
When an API sends timestamps inside JSON, our JSON formatter makes it easier to spot which fields hold them.

Frequently asked questions
Is Unix time the same as epoch time?
Yes, in everyday use. Strictly, the “epoch” is the starting moment, 1 January 1970 00:00:00 UTC, and Unix time is the count of seconds since then. People use both names for the count.
What time zone is a Unix timestamp in?
None. It counts from a moment defined in UTC, so it is the same number everywhere. A time zone only matters when you turn it into a readable date.
What is Unix timestamp 0?
Midnight UTC at the start of 1 January 1970. In India that was 5:30 a.m. on 1 January 1970.
How many digits is a Unix timestamp?
Ten digits in seconds and 13 digits in milliseconds for any date between September 2001 and November 2286.
When will the Unix timestamp reach 1.8 billion?
At 08:00:00 UTC on 15 January 2027, which is 1:30 p.m. IST. We calculated this with Python’s datetime library.
Can a Unix timestamp be negative?
Yes. Negative values are times before 1970. For example, -86400 is 31 December 1969 at 00:00 UTC. Some software does not accept them, so test first.
How do I convert a date to a Unix timestamp?
In Python, use datetime(2026, 10, 5, tzinfo=timezone.utc).timestamp(), which gives 1791158400. In Excel, use =(A1-DATE(1970,1,1))*86400 with a UTC date in A1. In MySQL, use UNIX_TIMESTAMP('2026-10-05 00:00:00'), which reads the date in the session time zone.