/ date and time / timestamp
Remove adsMember
Theme: SystemContrast: Standard

Unix timestamp converter

Convert Unix timestamps to dates and back, in any time zone, with ISO 8601, RFC 2822 and relative time.

Code examples

Copy and paste these into your own project. Each one uses only the language's standard library, so there is nothing to install.

Example

Star up to 3 languages to show them first on every tool page.

Favorite JavaScript
const now = Math.floor(Date.now() / 1000)

console.log(now)

What it does

Convert Unix timestamps to readable dates and dates back to timestamps, in any time zone. It understands seconds, milliseconds, microseconds and nanoseconds, and writes ISO 8601, RFC 2822 or plain Unix time.

How to use it

  1. Type or paste a Unix timestamp or a date: ISO 8601, RFC 2822, an HTTP date, 2023-11-14 22:13 or 14-11-2023. Now inserts the current time.
  2. Leave the unit on Detect unit, or choose seconds, milliseconds, microseconds or nanoseconds.
  3. Pick the time zone to read dates without an offset in, and the format to write.
  4. Read every format of that moment in the rows below and edit any of them: the others follow. The start and end of its day, month and year, and how far it is from now, are listed too.
  5. Use Several lines to convert one value per line, and the duration box to turn seconds into years, days, hours, minutes and seconds.

Examples

1700000000        →  2023-11-14T22:13:20.000Z
1700000000123     →  2023-11-14T22:13:20.123Z
2023-11-14 23:13  →  1699999980 (read in Europe/Amsterdam, UTC+1)

Good to know

  • A timestamp names one exact moment. The time zone only changes how it is written.
  • Up to 10 digits are read as seconds, 13 as milliseconds, 16 as microseconds and 19 as nanoseconds.
  • A date with no offset is read as local time in the zone you chose; add Z or +01:00 to be explicit.
  • Dates run from year 0000 to 9999.
  • 03-04-2023 could be 3 April or 4 March. Date order decides how it is read: day first or month first.
  • The live clock shows the current time in seconds, milliseconds, microseconds and nanoseconds. Your browser only gives milliseconds, so the last two end in zeros. Pause it to copy a value.

The current time in code

JavaScript   Math.floor(Date.now() / 1000)
Python       int(time.time())
Go           time.Now().Unix()
PHP          time()
SQL          SELECT EXTRACT(EPOCH FROM NOW())::bigint;  -- PostgreSQL
Bash         date +%s

What is a Unix timestamp?

A Unix timestamp counts the time since 1 January 1970 00:00:00 UTC, the Unix epoch. It is usually written in seconds, but many systems use milliseconds (JavaScript, Java), microseconds or nanoseconds. A timestamp always names one exact moment, whatever the time zone.

Frequently asked questions

How does the tool know if a number is in seconds or milliseconds?

By its size: up to 10 digits is read as seconds, 13 digits as milliseconds, 16 as microseconds and 19 as nanoseconds. Pick a unit yourself if your values are unusual.

What happens with a date that has no time zone?

It is read as a wall-clock time in the time zone you chose, UTC by default. Add Z or an offset such as +01:00 to the date and that is used instead.

Does this tool send my timestamps anywhere?

No. Everything is calculated on your device with your browser's built-in date support. What you type is never sent to our servers.

Changelog for this tool

Keyboard shortcuts

Close

Everywhere

Search tools and actions
Ctrl K
Show this help
?
Switch theme
Ctrl Shift L
Pin the selected tool (in search)
Ctrl P

On a tool

Send the output to the first suggestion
Ctrl ↵
Open a file into the input
Ctrl O
Copy the output
Ctrl Shift C
Close searchesc
toolsBase64 encoder and decoderEncode text to Base64 or decode Base64 back to text, with standard and URL-safe alphabets.EncodingJSON formatter and validatorFormat, minify and validate JSON, with the exact line and column of any error.FormattingRegex testerTest JavaScript regular expressions with live highlighting, capture groups and a plain-language explanation.TextUUID and ULID generatorGenerate UUID v4, UUID v7 and ULID in bulk, or paste an ID to see its version, variant and timestamp.GeneratorsUnix timestamp converterConvert Unix timestamps to dates and back, in any time zone, with ISO 8601, RFC 2822 and relative time.Date and timeHash and HMAC generatorCalculate MD5, SHA-1, SHA-2, SHA-3, BLAKE2, BLAKE3 and CRC-32 hashes of text or a file, with optional HMAC.SecurityPassword generator and strength checkerGenerate random passwords, passphrases and PINs, or check how strong a password is.SecurityJWT decoder and verifierDecode a JSON Web Token, check its expiry and claims, and verify its signature with a secret or public key.SecurityCIDR and IP subnet calculatorCalculate the range, mask and size of IPv4 and IPv6 networks, split them into subnets, and check what contains or overlaps what.NetworkCron expression explainerRead a cron expression in plain language, see its next runs in any time zone, and tidy it into its standard form.Date and timeSort linesSort lines of text A to Z or Z to A, in natural order (file2 before file10), by code point, by number or by length.TextRemove duplicate linesRemove duplicate lines from a list, keep the first or last copy, ignore case or spaces, or drop every line that repeats.TextCompare lists and textCompare two lists line by line: find what is in both, only in one, or in either, or see a marked line diff side by side.TextText case converter and slugifyConvert text to camelCase, snake_case, kebab-case, Title Case and more, or turn a title into a URL slug with accents handled.TextURL encode, decode and parsePercent-encode and decode text for URLs, or take a URL apart into scheme, host, path and query and edit the query as a table.EncodingValidators: IBAN, BSN, VAT, card and ISBNCheck an IBAN, Dutch BSN, credit card number, EU VAT number, email address, URL or ISBN, with the reason when it fails. One value per line.ValidationHTML entity encoder and decoderEscape text for HTML with named, decimal or hex entities, or turn entities such as & and é back into characters.EncodingEscape and unescape stringsEscape text for a JSON or JavaScript string, a SQL string, a CSV field, a regular expression or a shell word, or undo the escaping.EncodingEAN, UPC and GTIN check digitsCheck the check digit of an EAN-8, EAN-13, UPC-A or GTIN-14, add a missing one, read the country from the GS1 prefix and convert between ISBN-10 and EAN-13. One code per line.ValidationTest data generatorGenerate valid-looking test IBANs, BSNs, EAN barcodes and EU VAT numbers in bulk. They pass the checks, but belong to no one.GeneratorsSQL formatter and minifierFormat SQL so each clause sits on its own line, or minify it onto one line, for MySQL, PostgreSQL, SQLite, SQL Server and BigQuery.FormattingNumber base converterConvert numbers between binary, octal, decimal, hex and any base from 2 to 36, with big numbers, two's complement and a bit view.EncodingYAML, TOML and JSON converterConvert between JSON, YAML and TOML, or validate and pretty-print a document, with the line and column of every error.FormattingCSV and JSON converterConvert CSV to a JSON array of objects or arrays, or JSON back to CSV. Detects the delimiter and reads Dutch Excel files with semicolons and decimal commas.DataGlob and .gitignore testerTest glob patterns and .gitignore rules against a list of paths and see which paths match and which rule matched them.TextColour converterConvert a colour between HEX, RGB, HSL, HWB and OKLCH, check its WCAG contrast against a background, or build a Material 3 tonal palette from it.Formattingchmod calculatorConvert Unix file permissions between octal (755), letters (rwxr-xr-x), ls -l and chmod clauses, with a checkbox grid and the setuid, setgid and sticky bits.SecurityUser-agent parserRead a user-agent string: browser, engine, OS, device type and whether it is a bot. Leave it empty to read your own browser.NetworkConvert cURL to codePaste a cURL command and get the same request as fetch, Axios, Python requests, Go or PHP. Nothing is run and nothing is sent.NetworkMarkdown previewWrite Markdown and see it rendered as you type, or copy the HTML. Raw HTML is shown as text and links are checked, so nothing in the preview can run.FormattingBarcode and QR code generatorMake a QR code, EAN-13, UPC-A, Code 128, ITF-14 or Data Matrix barcode, download it as SVG or PNG, or read a code from an image.GeneratorspagesChangelogWhat changed in each releasepagesAboutWhat codeknife.dev is and who makes itpagesIdeasSuggest improvements and vote on other visitors’ ideas.pagesPrivacyWhat leaves your browser and what is storedpagesAccessibilityConformance, known limitations and how to report a problempagesMembershipRemove ads and raise the limitspagesactions