Computer science
Unix timestamp (epoch) to date converter and back
Paste a timestamp and read the date in UTC and in your local time at once, or type a date and get the seconds since the epoch. The unit is worked out from the number of digits.
What Unix time is
Unix time counts the seconds since midnight on 1 January 1970 UTC, the epoch. It is how almost every operating system, database and protocol stores an instant: a single number, independent of time zones and daylight saving.
The number does not state its unit. Ten digits are seconds, thirteen milliseconds as in JavaScript and Java, sixteen microseconds and nineteen nanoseconds. For dates between 1973 and 2286 the number of digits is enough to tell, and that is what the automatic setting does.
The time zone only comes in when the date is written for a person: the same timestamp is midnight in London and one o'clock in Rome. That is why the result shows both UTC and your device's local time.
Common mistakes
- Reading milliseconds as seconds: a thirteen-digit timestamp read in seconds lands tens of thousands of years in the future.
- Leaving out the time zone: a date written without one may be read as UTC by one program and as local time by another.
- Storing seconds in a signed 32-bit integer: at 03:14:07 UTC on 19 January 2038 the value overflows and turns negative.
Frequently asked questions
Does Unix time count leap seconds?
No. Every day is exactly 86,400 seconds; when a leap second is added, systems repeat it or smear it. So Unix time is not an exact count of the physical seconds elapsed.
What is the year 2038 problem?
Systems that store seconds in a signed 32-bit integer can go up to 2,147,483,647, which is 19 January 2038. The next second becomes a negative number, which means 1901.
How do I get the current timestamp in a program?
In JavaScript Date.now() gives milliseconds, in Python time.time() seconds with decimals, in a Linux shell date +%s whole seconds. The Now button does the same here.
How this calculation works
UTC date = epoch (1970-01-01 00:00:00 UTC) + timestamp ÷ unit. The automatic unit is: seconds below 10^11, milliseconds below 10^14, microseconds below 10^17, nanoseconds otherwise. From a local date, the time-zone offset in force on that date, daylight saving included, is subtracted. The ISO week is the one containing Thursday: week 1 contains the year's first Thursday.
Related calculators
Hash generator
MD5, SHA-1, SHA-256, SHA-384 and SHA-512 of a text or of bytes, with a hash checker.
Password strength checker
Entropy in bits and time to guess it, with weak patterns recognised. Nothing leaves the browser.
Base64 converter
From text, integer, hexadecimal or binary to Base64 and back, with the 6-bit groups explained.
Colour converter
From HEX to RGB, HSL, HSV and CMYK and back, with the WCAG contrast of white and black text.