Date to Seconds Converter
Convert any date to Unix timestamp seconds or calculate the duration between two dates in seconds, minutes, hours, and days.
About
Unix timestamps represent time as the number of seconds elapsed since 1970-01-01T00:00:00Z (the Unix Epoch). This converter transforms any date into its epoch representation in seconds, critical for database storage, API communications, and cross-timezone calculations where human-readable formats introduce ambiguity. A single timezone miscalculation in financial systems can shift transaction timestamps by 3600 seconds per hour offset, causing audit failures and reconciliation errors.
The duration mode calculates the precise difference between two dates. Unlike naive approximations using 365.25 days per year, this tool computes actual elapsed time accounting for leap years, varying month lengths, and daylight saving transitions. Note: results assume UTC unless your browser interprets local timezone from the input - verify critical timestamps against a reference epoch table.
Formulas
The Unix timestamp conversion extracts milliseconds from the JavaScript Date object and divides by 1000 to obtain seconds:
Where tunix = Unix timestamp in seconds, and getTime() returns milliseconds since epoch.
For duration between two dates:
The unit breakdown follows integer division with modulo extraction:
Reference Data
| Time Unit | Seconds Equivalent | Common Use Case |
|---|---|---|
| 1 Minute | 60 | Session timeouts, rate limiting |
| 1 Hour | 3,600 | Cache expiration, JWT tokens |
| 1 Day | 86,400 | Daily cron jobs, log rotation |
| 1 Week | 604,800 | Password reset links, trials |
| 30 Days | 2,592,000 | Cookie expiration, billing cycles |
| 365 Days | 31,536,000 | Annual subscriptions, compliance |
| Leap Year | 31,622,400 | Accurate multi-year calculations |
| Unix Epoch Start | 0 | 1970-01-01 00:00:00 UTC |
| Y2K (2000-01-01) | 946,684,800 | Historical reference point |
| 32-bit Overflow | 2,147,483,647 | 2038-01-19 03:14:07 UTC (Y2K38) |
| Current Max Safe | 8,640,000,000,000 | JavaScript Date limit (~275,760 CE) |
| 1 Millisecond | 0.001 | High-precision timing, animations |
| 1 Microsecond | 0.000001 | Performance profiling |
| 1 Nanosecond | 0.000000001 | Hardware-level timing |
| Sidereal Day | 86,164.1 | Astronomical calculations |
| Mean Solar Day | 86,400.002 | Civil timekeeping average |
| Gregorian Year | 31,556,952 | Average accounting year |
| Julian Year | 31,557,600 | Astronomical standard (365.25 days) |
| Tropical Year | 31,556,925.2 | Seasonal cycle calculations |