Convert a Unix (epoch) timestamp to a date and time in any time zone, or a date back to a timestamp. Works with seconds, milliseconds, microseconds and nanoseconds, shows the current timestamp live and makes Discord timestamp codes.
Current Unix time (seconds since 1 January 1970 UTC)
…
Unix time counts seconds from 1 January 1970 00:00:00 UTC and ignores leap seconds. Times skipped or repeated when clocks change are read the way most software does: the first of a repeated hour, and the old offset for a skipped one.
How to use the Unix timestamp converter
The current Unix time ticks at the top; copy it with one tap.
To read a timestamp, paste it under "Timestamp to date". The unit is detected from the number of digits, or choose it.
Pick a time zone to see the date there; your own zone is selected to begin with.
To make a timestamp, choose "Date to timestamp" and enter the date, time and time zone. Open "Discord timestamp codes" to copy a code for a message.
Current timestamp in code
Seconds since 1970 in common languages.
Language
Code
JavaScript
Math.floor(Date.now() / 1000)
Python
import time; int(time.time())
PHP
time()
Java
Instant.now().getEpochSecond()
C#
DateTimeOffset.UtcNow.ToUnixTimeSeconds()
Go
time.Now().Unix()
MySQL
SELECT UNIX_TIMESTAMP();
PostgreSQL
SELECT EXTRACT(EPOCH FROM now());
Linux / macOS shell
date +%s
Example
The timestamp 1700000000 is 2023-11-14T22:13:20Z in UTC (ISO 8601) and 2023-11-15T03:43:20+05:30 in India. In milliseconds the same moment is 1700000000000.
It's the number of seconds since 00:00:00 UTC on 1 January 1970 (the Unix epoch), not counting leap seconds. Computers use it because it's one number with no time zone. For example 1,700,000,000 is 2023-11-14 22:13:20 UTC, which is 2023-11-15 03:43:20 in India (UTC+05:30).
Is my timestamp in seconds or milliseconds?
Count the digits. Today's timestamps are 10 digits in seconds and 13 digits in milliseconds (JavaScript's Date.now() and Java's System.currentTimeMillis() use milliseconds). Microseconds have 16 digits and nanoseconds 19. The converter detects this automatically, or you can pick the unit.
Does a Unix timestamp depend on the time zone?
No. The same timestamp is the same moment everywhere; only the way it's shown changes. Choose a time zone to see that moment as local time there, with its UTC offset. When you turn a date into a timestamp, the time zone matters, because 09:00 in New York and 09:00 in London are different moments.
How do I get the current Unix timestamp in code?
JavaScript: Math.floor(Date.now() / 1000). Python: int(time.time()). PHP: time(). Java: Instant.now().getEpochSecond(). Go: time.Now().Unix(). MySQL: UNIX_TIMESTAMP(). Linux or macOS shell: date +%s. The table on this page lists more.
What is the year 2038 problem?
Systems that store Unix time in a signed 32-bit number can count only up to 2,147,483,647 seconds, which is 2038-01-19 03:14:07 UTC. One second later the number overflows to a date in 1901. Software that uses 64-bit time, as modern systems do, is fine for billions of years.
How do Discord timestamps work?
Type a code like <t:1700000000:F> in a Discord message and every reader sees that moment in their own time zone and language. The letter at the end sets the style: t and T for the time, d and D for the date, f and F for date and time, s and S for a short date with the time, and R for relative time such as "in 3 hours". Convert your time here and copy the code.