Converts Unix timestamps to formatted date-time strings, or date-time strings to timestamps, supporting both second-level and millisecond-level timestamps with automatic input type detection
The Timestamp Converter is an online tool for converting between Unix timestamps and human-readable date-time strings. A Unix timestamp counts the seconds or milliseconds elapsed since January 1, 1970, 00:00:00 UTC (the Unix epoch). This tool supports both second-level (10-digit) and millisecond-level (13-digit) timestamp precision, automatically detecting the input type and performing two-way conversion.
Whether you are debugging API timestamps, inspecting database time fields, or converting human-readable dates into Unix timestamps for your programs, this tool delivers fast and accurate results. It auto-detects multiple date separators (- / / / . / Chinese 年月日), accepts month/day values with or without leading zeros, and handles both second-level and millisecond-level (.123) time parts — all without manual format specification.
Different programming languages define timestamp precision differently: JavaScript's Date.now() returns millisecond timestamps (13 digits), while PHP's time() returns second-level timestamps (10 digits). Python's time.time() defaults to second-level floats, and Go's time.Now().Unix() also works at the second level. Understanding these differences is essential for cross-language data exchange.
The core of timestamp conversion lies in Unix epoch time calculation. A Unix timestamp is a running counter starting from UTC 1970-01-01 00:00:00, recording the number of seconds (or milliseconds) elapsed. Date-to-timestamp conversion parses the input date-time string into a concrete point in time and calculates the difference from the Unix epoch. Timestamp-to-date conversion does the reverse.
This tool is implemented in PHP, using \DateTime::createFromFormat() to parse date strings into timestamps — for inputs with milliseconds (.123), it automatically extracts the millisecond portion and incorporates it into the final timestamp. For timestamp-to-date conversion, second-level timestamps use PHP's date() function, while millisecond-level timestamps (13 digits) are split into seconds and milliseconds, formatted via date() with the millisecond field (e.g., .123) inserted afterward.
Date.now() returns a millisecond timestamp (13 digits, e.g., 1704038400000), while PHP's time() returns a second-level timestamp (10 digits, e.g., 1704038400). The difference is a factor of 1000. Pay attention to conversion when exchanging data between frontend and backend. This tool supports both precisions and auto-detects by digit count.2026-01-01 12:30:45.123 yields 1767241845123. If you only want a second-level result, use the explicit format dt|2026-01-01 12:30:45.123|Y-m-d H:i:s.v|s.1767241845123 → 2026-01-01 12:30:45.123). You can also use 1767241845123|Y-m-d to show only the date, or 1767241845123|Y/m/d H:i:s.v to customize the separator.2026-01-01, 2026/1/1, 2026.1.1, 2026年1月1日 (date separators); 12:30, 12:30:45, 12:30:45.123 (time part, milliseconds optional). Month and day values work with or without leading zeros. For other formats, use dt|date|format|s explicitly.Auto-detect — second-level timestamp to date:
Input: 1704038400
Output: 2024-01-01 00:00:00
Auto-detect — millisecond timestamp to date (with ms):
Input: 1767241845123
Output: 2026-01-01 12:30:45.123
Auto-detect — date to millisecond timestamp:
Input: 2026/1/1 12:30:45.123
Output: 1767241845123
Custom format — timestamp to date:
Input: 1704038400|Y-m-d
Output: 2024-01-01
Explicit — date to millisecond timestamp:
Input: dt|2024-01-01|Y-m-d|ms
Output: 1704038400000
This tool belongs to the same numerical conversion category as Base Converter, sharing a similar logic for handling different precision conversions. When debugging time parameters in URLs, pair it with URL Decoder to decode the content before converting the timestamp. For verifying data integrity in hash calculations involving time data, MD5 can help.
After converting a timestamp to a readable date, use World Time to see the corresponding time across global time zones. For understanding character encoding and numerical relationships, ASCII Lookup provides cross-reference tables for character encodings in different bases.