Adding and Subtracting Time from a Date
Relative Time
When to Use Relative Offsets
Calculate future or past dates for token expiry, trial end dates, cache TTL debugging, scheduled job previews, and answering "what date is 90 days from now?"
Offset Format
Line 1: base date. Line 2: offset like +3 days, -2 weeks, or +90 minutes. Supported units include seconds, minutes, hours, days, weeks, months, and years.
Common Mistakes
- Month arithmetic crossing month boundaries (Jan 31 + 1 month)
- Forgetting timezone context on the base date
- Using relative offsets where absolute UTC storage is required
Developer Tips
- Use
+7 daysfor week-based trials instead of manual date math - Verify month/year additions near month-end for billing logic
- Combine with ISO 8601 parser to format output for APIs
Frequently asked questions
What offset units are supported?
Seconds, minutes, hours, days, weeks, months, and years. Prefix with + or - for forward or backward adjustment.
How are months and years calculated?
Months and years adjust the calendar date, which may land on a different day when crossing short months (e.g. Jan 31 plus 1 month).
Can I use the current time as the base?
Yes. Leave line 1 empty or use "now" to start from the current date and time.