Timestamp Guide
What is Unix Timestamp?
The Unix timestamp is the number of seconds that have elapsed since January 1, 1970 (UTC). It is widely used in computer systems to track time independently of timezones.
Seconds vs Milliseconds
- Seconds (10 digits): The traditional format. Example:
1678888888. - Milliseconds (13 digits): Java, JavaScript, and modern APIs often use this.
Example:
1678888888000.
Get Timestamp in Code
- JavaScript:
Date.now()(ms) orMath.floor(Date.now() / 1000)(s) - Python:
import time; time.time() - Java:
System.currentTimeMillis() - Go:
time.Now().Unix()