Timestamp Arithmetic
Add or subtract any duration from a Unix timestamp. Quick presets for JWT tokens, sessions, cookies, and more.
How Timestamp Arithmetic Works
Unix timestamp arithmetic is simple integer math. Because a Unix timestamp is just the number of seconds elapsed since January 1, 1970 UTC, adding or subtracting time is as straightforward as adding or subtracting the equivalent number of seconds.
Fixed durations — minutes, hours, days, and weeks — are exact. Months and years are more nuanced because calendar months vary in length. This tool uses the average Gregorian values (30.4369 days/month, 365.2425 days/year) for month/year arithmetic, which is the standard approach for expiry and TTL calculations.
Common Duration Reference
| Duration | Seconds | Common Use Case |
|---|---|---|
| 15 minutes | 900 | Short-lived OTP / CSRF token |
| 1 hour | 3,600 | Access token / session TTL |
| 24 hours | 86,400 | Daily reset / cookie expiry |
| 7 days | 604,800 | Refresh token / remember-me |
| 30 days | 2,592,000 | Subscription period |
| 90 days | 7,776,000 | TLS certificate renewal window |
| 1 year (avg) | 31,556,952 | Annual license / long-lived token |
Frequently Asked Questions
How do I add 30 days to a Unix timestamp?▼
Multiply 30 × 86,400 = 2,592,000 and add to your timestamp. e.g. 1700000000 + 2592000 = 1702592000. Use this tool's "30 days" preset to do it instantly.
How do I calculate a JWT "exp" claim?▼
The exp claim is a future Unix timestamp (in seconds). Take the current timestamp and add your desired TTL: exp = now + 3600 for 1 hour. JWTs are typically valid for 15 min–1 hour for access tokens and 7–30 days for refresh tokens.
Why do months give different results each time?▼
Calendar months have 28–31 days. This tool uses the average Gregorian month (≈30.44 days = 2,629,746 seconds). If you need exact calendar-month boundaries, use the Date Difference tool or specify an explicit day count instead.
Can I subtract time to get a past timestamp?▼
Yes — enter a negative value or use the subtract mode. Negative Unix timestamps (before 1970) are also valid and fully supported.
What is the difference between Unix seconds and milliseconds?▼
Seconds timestamps are 10 digits (e.g. 1700000000). Millisecond timestamps are 13 digits (1700000000000). JavaScript's Date.now() returns ms. Multiply or divide by 1000 to convert between them.