Calculate date/time differences (Claude should use date command directly)
Calculate the difference between two dates or times using natural language expressions. Perfect for tracking deadlines, project milestones, and event planning.
/plugin marketplace add cadrianmae/claude-marketplace/plugin install datetime@cadrianmae-claude-marketplaceCalculate the difference between two dates or times using natural language expressions.
If you are Claude: DO NOT invoke this slash command. Use unix timestamp arithmetic via Bash tool:
date1=$(date -d "first date" +%s)
date2=$(date -d "second date" +%s)
diff=$((date2 - date1))
echo "Difference: $diff seconds"
See the Implementation section below for the full calculation pattern.
/datetime:calc
The command will interactively ask for two date/time expressions, then calculate the difference.
The calculation uses unix timestamps internally for accuracy across timezones and DST boundaries.
Convert dates to unix timestamps:
date1_ts=$(date -d "first expression" +%s)
date2_ts=$(date -d "second expression" +%s)
Calculate difference:
diff_seconds=$((date2_ts - date1_ts))
diff_days=$((diff_seconds / 86400))
diff_hours=$(((diff_seconds % 86400) / 3600))
diff_minutes=$(((diff_seconds % 3600) / 60))
diff_secs=$((diff_seconds % 60))
Display result:
echo "Difference: ${diff_days}d ${diff_hours}h ${diff_minutes}m ${diff_secs}s"
echo "Total: ${diff_seconds} seconds"
# Days until deadline
/datetime:calc
→ First date/time: today
→ Second date/time: 2024-12-15
→ Difference: 32d 0h 0m 0s (32 days)
→ Total: 2764800 seconds
# Time since event
/datetime:calc
→ First date/time: 2024-11-01
→ Second date/time: today
→ Difference: 12d 0h 0m 0s (12 days)
→ Total: 1036800 seconds
# Hours between meetings
/datetime:calc
→ First date/time: today 14:00
→ Second date/time: tomorrow 10:30
→ Difference: 0d 20h 30m 0s
→ Total: 73800 seconds
# Working days remaining
/datetime:calc
→ First date/time: today
→ Second date/time: next Friday
→ Difference: 2d 0h 0m 0s (2 days)
→ Total: 172800 seconds
Academic deadlines:
Project milestones:
Event planning:
Time tracking:
/datetime:now - Get current date/time/datetime:parse - Parse natural language date expressions