Date to Timestamp
Date → Unix timestamp / multi time zone / batch conversion
Date to timestamp
Batch date to timestamp
What is date-to-timestamp conversion?
Date-to-timestamp conversion turns a human-readable date and time (such as 2024-01-15 12:30:00) into a Unix timestamp — the number of seconds or milliseconds since 1970-01-01 00:00:00 UTC. In software development, data exchange and logging, dates usually have to become timestamps first. This tool outputs both seconds and milliseconds and covers 40+ time zones for accurate conversion.
How is it calculated?
By hand it takes three steps: step one, convert the input to UTC by subtracting the time zone offset (Beijing is UTC+8, so subtract 8 hours); step two, count the total seconds from 1970-01-01 00:00:00 UTC to that UTC instant, using 366 days for leap years; step three, that gives the 10-digit seconds timestamp, and multiplying by 1000 gives the 13-digit millisecond one.
Full worked example
Beijing time 2026-01-01 00:00:00 → step one gives 2025-12-31 16:00:00 UTC; step two counts from 1970-01-01 00:00:00 to 2025-12-31 16:00:00 as 20,453 days and 16 hours (1970 to 2025 is 56 years with 14 leap years: 1972, 1976, 1980, 1984, 1988, 1992, 1996, 2000, 2004, 2008, 2012, 2016, 2020, 2024 — 56 × 365 + 14 = 20,454 days, so 20,453 days up to 2025-12-31 00:00), totalling 20,453 × 86400 + 16 × 3600 = 1,767,196,800 seconds, with 1,767,196,800,000 in milliseconds. In day-to-day work there is no need to do this by hand — use this tool or your language’s date API.
The Year 2038 problem and timestamp limits
The 32-bit timestamp ceiling is 2147483647, which is 2038-01-19 03:14:07 UTC; anything beyond overflows, the "Year 2038 problem". Modern 64-bit systems and JavaScript (double-precision floats) are unaffected, and this tool converts dates past 2038 normally. For more detail see thetimestamp converter page。
Common dates and their timestamps
The seconds-level timestamps below are calculated at midnight Beijing time; you can verify any of them by entering the date from the left column above.
| Date (Beijing time) | Seconds timestamp | Note |
|---|---|---|
| 1970-01-01 08:00:00 | 0 | Unix epoch (epoch zero in Beijing time) |
| 2000-01-01 00:00:00 | 946656000 | Start of the new millennium |
| 2026-01-01 00:00:00 | 1767196800 | New Year’s Day 2026 |
| 2027-01-01 00:00:00 | 1798732800 | New Year’s Day 2027 |
| 2028-01-01 00:00:00 | 1830268800 | New Year’s Day 2028 |
| 2038-01-19 11:14:07 | 2147483647 | 32-bit timestamp ceiling |
How to use the date-to-timestamp converter
The top of the page shows the live current timestamp, refreshing every second — click it to copy, no action required. Enter a standard date such as 2026-08-20 18:30:00, or use the date-time picker to choose visually. After picking a time zone the result area shows the seconds and millisecond timestamps plus the weekday; click Copy to take what you need. Below that are quick chips for "now / today 00:00 / tomorrow 00:00". In batch mode put one date per line to convert many at once, which is handy for processing logs or database records. For the reverse conversion use thetimestamp-to-date tool.
Date-to-timestamp FAQ
Which date formats are supported?
Common formats work, such as 2024-01-15 12:30:00, 2024/01/15 12:30:00 and 2024-1-15 12:30. You can pick a date visually with the date-time picker or simply type one in — the tool recognises it without needing a strict format.
Does the result come back in seconds or milliseconds?
Both. The result area shows the seconds-level timestamp (a 10-digit number such as 1705293000) and the milliseconds-level timestamp (a 13-digit number such as 1705293000000), so you can copy whichever your project needs.
Does the time zone change the result?
Yes. The same moment maps to different timestamps in different time zones, because a timestamp counts seconds from UTC. Entering Beijing time with the "Asia/Shanghai" zone selected gives the correct timestamp for Beijing time. The tool covers 40+ time zones.
How does date-to-timestamp differ from timestamp-to-date?
They are inverse operations. Date-to-timestamp turns a human-readable date into a machine-readable number, typically for API parameters or database writes; timestamp-to-date turns a number back into a readable time, typically for log analysis and debugging. The companion page is the timestamp-to-date tool.
Is this tool safe? Could my data leak?
Yes, it is safe. Every conversion runs locally in your browser with no back-end service, so the dates you enter are never uploaded. Batch conversion is processed on the front end too.
How do I get the current timestamp in code?
Common idioms: JavaScript Math.floor(Date.now() / 1000) for seconds (Date.now() itself is milliseconds); Java System.currentTimeMillis() / 1000; Python int(time.time()); Go time.Now().Unix(); MySQL SELECT unix_timestamp(now()). More complete examples for other languages are in the code examples section of the timestamp converter, which also covers converting back to a date.
Why do timestamps start in 1970?
The designers of Unix picked 1970-01-01 00:00:00 UTC as the epoch in the early 1970s, while the system was still being built, because a round starting point made the arithmetic easy. POSIX later adopted the convention and it became an industry standard, so all Unix timestamps accumulate from 1 January 1970.
Will Unix timestamps run out?
Eventually, but it does not affect everyday use. The maximum on 32-bit systems is 2147483647 (2038-01-19 03:14:07 UTC); overflow beyond that is the "Year 2038 problem". Modern systems use 64-bit timestamps, which reach hundreds of billions of years into the future. JavaScript stores time as a double-precision float and is likewise unaffected.