Skip to content
Developer tools

Unix Timestamp Converter

Convert a Unix timestamp to a date and a date to a timestamp, in seconds or milliseconds, with time zones.

Last checked

Current Unix time

...seconds

Timestamp or date to a date

Result

Enter a timestamp or a date to see it in UTC, in a time zone, in words, as an RFC date and relative to now.

Date and time to a timestamp

Pick a date and a time zone to get the Unix timestamp. Daylight saving time is taken into account.

Convert every timestamp in a log

Unix time in code

LanguageCurrent timestamp (seconds)Timestamp ts to a date
JavaScriptMath.floor(Date.now() / 1000)new Date(ts * 1000).toISOString()
Pythonimport time; int(time.time())datetime.fromtimestamp(ts, tz=timezone.utc)
Gotime.Now().Unix()time.Unix(ts, 0).UTC()
JavaInstant.now().getEpochSecond()Instant.ofEpochSecond(ts)
C#DateTimeOffset.UtcNow.ToUnixTimeSeconds()DateTimeOffset.FromUnixTimeSeconds(ts)
PHPtime()gmdate('c', $ts)
PostgreSQLextract(epoch from now())::bigintto_timestamp(ts)
MySQLUNIX_TIMESTAMP()FROM_UNIXTIME(ts)
Bash (GNU date)date +%sdate -u -d @$ts
macOS datedate +%sdate -u -r $ts

How to use it

  1. Paste a timestamp or a date. The unit is detected from the number of digits, and you can set it yourself.
  2. Type a time zone name to show the date in it. Copy any value with its button, or copy the start and end of the period.
  3. To go the other way, pick a date, a time and a zone in the lower section and copy the timestamp.
  4. To convert a log, paste it into Convert every timestamp in a log and copy the table as CSV.

What it checks and why

Unix time counts the seconds since 1 January 1970 at 00:00 UTC, the Unix epoch, ignoring leap seconds. It is the same number everywhere on Earth, which is why servers, databases and APIs use it: no time zone and no daylight saving to get wrong. Many systems use milliseconds instead, so 1700000000 and 1700000000000 are the same moment in different units. The converter tells them apart by the digits: ten is seconds, thirteen is milliseconds.

A person needs a date. The converter shows the moment in UTC, in the form that APIs expect (ISO 8601), in the older RFC 2822 form used by email and HTTP, and in any time zone with its offset from UTC. Time zone data comes from your browser, which keeps the IANA time zone database, so the offsets include daylight saving time as it was and will be.

The lower section goes the other way. You give a date and a time as they appear on a wall clock, and a zone, and it works out the instant. This is where daylight saving time bites: a clock time that does not exist on the night the clocks jump forward, or one that exists twice when they go back. The tool picks the earlier instant for an ambiguous time and shows the later one too, and moves a skipped time forward by the jump with a note. A date and time without a zone is read in your local time, while a date alone such as 2026-10-18 is midnight UTC, the JavaScript rule for ISO dates; the tool says which applied.

Specs and sources

Limits

  • JavaScript dates cover about 275 000 years around 1970. A value outside that range cannot be shown.
  • Dates are shown to the millisecond, because JavaScript dates hold milliseconds. The µs and ns epoch values keep every digit you typed.
  • The log converter finds 10, 13, 16 and 19 digit numbers and ISO date-times, the first 500 of them. Other numbers of that length, such as phone numbers, are converted too.
  • Leap seconds are ignored, as in Unix time itself, so the value can differ from atomic time by a few seconds.
  • Time zone rules come from your browser. An old browser can have an out-of-date list of daylight saving changes.

Questions

What is a Unix timestamp?
The number of seconds since 1 January 1970 at 00:00 UTC. It names a moment without a time zone, so a server in one country and a phone in another agree on it.
How do I tell seconds from milliseconds?
Count the digits. A current timestamp in seconds has ten digits, such as 1700000000, and in milliseconds it has thirteen, such as 1700000000000. The converter detects it for you.
What is the year 2038 problem?
A signed 32-bit counter of seconds overflows on 19 January 2038 at 03:14:07 UTC, the value 2147483647. Systems that still store time in 32 bits then wrap to 1901. Try 2038 in the tool to see it.
Why does my date shift by some hours?
A date and time with no zone is read in your local time, while a date alone is read as midnight UTC, so the same text can land hours apart. Add Z or an offset such as +02:00, or choose the zone to show it in.
How do I get the current Unix timestamp in JavaScript?
Date.now() returns the milliseconds since 1 January 1970 UTC. For a timestamp in seconds, use Math.floor(Date.now() / 1000).
How do I get the current Unix timestamp in Python, SQL or bash?
Python: int(time.time()). PostgreSQL: extract(epoch from now())::bigint. MySQL: UNIX_TIMESTAMP(). Bash: date +%s. The tool lists these and the reverse conversions under Unix time in code.
How do I get the timestamp for the start of a day?
Convert any moment of that day and read Start and end of the period: it gives the first and last second of the day, week, month and year in the zone you chose, with daylight saving applied.