Need safe multi-accounting? Compare the top-rated solutions at AntiDetect Hub. Explore Now

Unix Timestamp Converter

5 of 1 ratings

Convert a Unix timestamp to a date, a date to a timestamp, or watch the current timestamp. Everything is calculated in your browser: nothing is uploaded.

Unit
UTC
ISO 8601
In the selected time zone
Day of the week
Compared to now
Timestamp in seconds
Timestamp in milliseconds
Accepted: 2023-11-14 22:13:20, 2023-11-14T22:13:20Z, 2023-11-14T22:13:20+03:00, Tue, 14 Nov 2023 22:13:20 GMT. Without an offset or Z the time is read in the time zone above.
Timestamp in seconds
Timestamp in milliseconds
UTC
ISO 8601

The timestamp of this moment, updated every second.

Timestamp in seconds
Timestamp in milliseconds
UTC
ISO 8601
In the selected time zone

How to get a Unix timestamp in code

The examples use 1700000000, which is 2023-11-14 22:13:20 UTC.

Language Current timestamp Timestamp to date Date to timestamp
Python import time int(time.time()) from datetime import datetime, timezone datetime.fromtimestamp(1700000000, tz=timezone.utc) int(datetime(2023, 11, 14, 22, 13, 20, tzinfo=timezone.utc).timestamp())
Without tzinfo Python uses the time zone of the computer.
JavaScript Math.floor(Date.now() / 1000) new Date(1700000000 * 1000).toISOString() Math.floor(Date.UTC(2023, 10, 14, 22, 13, 20) / 1000)
Date works in milliseconds, and the month starts at 0 (10 is November).
PHP time() gmdate('Y-m-d H:i:s', 1700000000) strtotime('2023-11-14 22:13:20 UTC')
date() uses the time zone of the script, gmdate() always UTC.
MySQL SELECT UNIX_TIMESTAMP(); SELECT FROM_UNIXTIME(1700000000); SELECT UNIX_TIMESTAMP('2023-11-14 22:13:20');
FROM_UNIXTIME and UNIX_TIMESTAMP use the time zone of the session; SET time_zone = '+00:00' for UTC.
PostgreSQL SELECT EXTRACT(EPOCH FROM now())::bigint; SELECT to_timestamp(1700000000); SELECT EXTRACT(EPOCH FROM TIMESTAMPTZ '2023-11-14 22:13:20+00')::bigint;
to_timestamp returns a time with the time zone of the session.
Excel =(NOW()-DATE(1970,1,1))*86400 =A1/86400+DATE(1970,1,1) =(A1-DATE(1970,1,1))*86400
Format the result cell as a date and time. NOW() is the time of the computer, not UTC.
1C ТекущаяУниверсальнаяДата() - Дата(1970, 1, 1) Дата(1970, 1, 1) + 1700000000 Дата(2023, 11, 14, 22, 13, 20) - Дата(1970, 1, 1)
The result is the date in UTC; ТекущаяДата() would give the time of the server.

Unix Timestamp Converter: Timestamp to Date and Date to Timestamp

Paste a Unix timestamp to see the date in UTC and in any time zone, type a date to get its Unix timestamp, or open the third tab for the current timestamp, which updates every second. The unit (seconds, milliseconds, microseconds or nanoseconds) is found from the number of digits. Everything is calculated in your browser: nothing you type is uploaded.

What is a Unix timestamp

A Unix timestamp is the number of seconds that have passed since 00:00:00 UTC on 1 January 1970, the Unix epoch, not counting leap seconds. It is the same number everywhere in the world at the same moment, so it is a simple way to store and compare times. The timestamp 1700000000 is 14 November 2023, 22:13:20 UTC. Dates before 1970 have a negative timestamp.

Seconds, milliseconds, microseconds and nanoseconds

Languages and databases count the timestamp in different units. The converter chooses the unit from the length of the number, and you can set it yourself in the unit field.

  • 10 digits, seconds: 1700000000 (PHP time(), Python time.time(), MySQL UNIX_TIMESTAMP()).
  • 13 digits, milliseconds: 1700000000123 (JavaScript Date.now(), Java System.currentTimeMillis()).
  • 16 digits, microseconds: 1700000000123456 (many databases and logs).
  • 19 digits, nanoseconds: 1700000000123456789 (Go UnixNano(), Python time.time_ns()).

Small numbers are read as seconds: a value of up to 11 digits could also be milliseconds of a date in early 1970, so set the unit by hand for those.

Time zones and daylight saving time

A Unix timestamp has no time zone. The time zone only changes how the date is written: 1700000000 is 22:13:20 in UTC and 01:13:20 the next day in Moscow. To turn a date into a timestamp the tool needs the zone of that date, which you choose above the fields, unless the text has its own offset, as in 2023-11-14T22:13:20+03:00. When the clocks change, a time can be missing (spring) or can happen twice (autumn). The tool tells you in both cases and shows the first of the two moments.

How to get a Unix timestamp in code

The table under the converter has the code for Python, JavaScript, PHP, MySQL, PostgreSQL, Excel and 1C: the current timestamp, a timestamp to a date, and a date to a timestamp.

The year 2038 problem

Many old systems keep the timestamp in a signed 32-bit number, which ends at 2147483647, that is 03:14:07 UTC on 19 January 2038. After that it overflows to a negative number. Systems with a 64-bit timestamp, which is now the usual, are not affected. Put 2147483647 into the converter and add one to see the date.

Limitations

  • Leap seconds are not counted, as in the Unix timestamp itself.
  • Dates from the year -271821 to 275760 are supported, which is the range of the JavaScript date. The time zone is shown for the years 1 to 9999.
  • Time zone rules come from your browser, so very new changes of rules may be missing in an old browser.
  • Fractions are kept down to the nanosecond when you write them in the number or in the date.

Similar tools

Decimal Converter

Decimal converter online: decimal to binary, hex and octal and back, any size, with bit widths and two's complement, and text to decimal codes. Works in your browser.

7
Hex Converter

Hex converter online: hexadecimal to decimal, binary and text and back, any size, plus float to hex (IEEE 754, 32 and 64 bit). Works in your browser.

6
Base64 Encoder / Decoder

Encode text to Base64 or decode Base64 back to text online, instantly in your browser. UTF-8 and URL-safe Base64 supported.

12

Popular tools