Unix Time in Seconds
Unix time in seconds is the standard representation: a 10-digit integer counting the seconds elapsed since January 1, 1970, 00:00:00 UTC. This is the "classic" Unix timestamp format, used by default in Python, PHP, Go, Ruby, C, Bash, and most SQL databases. The current value is shown live at the top of this page.
Unix time in seconds is called a 10-digit timestamp because it will remain 10 digits until November 20, 2286, when it becomes 11 digits. The maximum value representable by a 32-bit signed integer is 2,147,483,647, which corresponds to January 19, 2038 — this is the source of the Year 2038 Problem for legacy systems. All modern systems use 64-bit integers, which extend the range to the year 292 billion.
Conversion factors for seconds
1 minute = 60 seconds
1 hour = 3,600 seconds
1 day = 86,400 seconds
1 week = 604,800 seconds
1 month (avg) ≈ 2,629,800 seconds
1 year (non-leap) = 31,536,000 seconds
1 year (leap) = 31,622,400 seconds
Unix time in seconds: code examples
Get current Unix time in seconds:
Python: int(time.time())
JavaScript: Math.floor(Date.now() / 1000)
PHP: time()
Go: time.Now().Unix()
Bash: date +%s
Convert seconds to milliseconds: multiply by 1000
Convert milliseconds to seconds: integer-divide by 1000
Use the seconds-to-duration converter (section 4 on this page) to break down any number of seconds into years, months, days, hours, and minutes.