Natural language date calculations and formatting
Project description
datemath
Natural language date calculations and formatting.
A simple CLI for working with dates, times, and durations. Designed for humans and AI agents alike.
Installation
pip install datemath-cli
Usage
Current Time
datemath now # Show current time in multiple formats
datemath now --tz UTC # In specific timezone
datemath now --json # JSON output
Add Duration
datemath add "3 weeks" # 3 weeks from now
datemath add "2 months" # 2 months from now
datemath add "1 year 2 months" # Combine units
datemath add "5 days" --from "2026-01-01" # From specific date
Subtract Duration
datemath sub "1 week" # 1 week ago
datemath sub "3 months" # 3 months ago
Between Dates
datemath between "2026-01-01" "2026-12-31" # Days/weeks/months between
datemath between "today" "2026-12-25" # Until Christmas
datemath between "yesterday" "tomorrow" # 2 days
Parse Natural Language
datemath parse "next tuesday" # Parse to ISO date
datemath parse "tomorrow" # Tomorrow's date
datemath parse "in 3 weeks" # 3 weeks from now
datemath parse "2 days ago" # 2 days ago
datemath parse "last friday" # Previous Friday
Format Dates
datemath format "2026-02-03" --fmt "%B %d, %Y" # February 03, 2026
datemath format "tomorrow" --fmt "%A" # Weekday name
datemath format "now" --fmt "%Y%m%d_%H%M%S" # Filename-safe
Timezone Conversion
datemath tz "2026-02-03T12:00" --from UTC --to America/Los_Angeles
datemath tz "now" --from America/New_York --to Europe/London
datemath zones # List common timezones with current time
Duration Syntax
Supported units:
y,year,years— Yearsmo,month,months— Monthsw,week,weeks— Weeksd,day,days— Daysh,hour,hours— Hoursm,min,minute,minutes— Minutess,sec,second,seconds— Seconds
Combine freely: "1 year 2 months 3 days", "1y 2mo 3d", "90 days"
JSON Output
All commands support --json for machine-readable output:
datemath now --json
{
"iso": "2026-02-03T12:00:00",
"unix": 1770184800,
"date": "2026-02-03",
"time": "12:00:00",
"human": "February 03, 2026 at 12:00 PM",
"weekday": "Tuesday",
"timezone": "local"
}
For AI Agents
See SKILL.md for agent-optimized documentation.
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file datemath_cli-0.1.0.tar.gz.
File metadata
- Download URL: datemath_cli-0.1.0.tar.gz
- Upload date:
- Size: 5.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2f41caf4c573f628d41576d60d7f6754f38f1d01cc7d7371458883f15591c7ec
|
|
| MD5 |
362bcb55d534c3e7de674fb8a5f9e575
|
|
| BLAKE2b-256 |
a0346676455bd41341614f61f92420e97136704566e3556cd6444a9dd036a602
|
File details
Details for the file datemath_cli-0.1.0-py3-none-any.whl.
File metadata
- Download URL: datemath_cli-0.1.0-py3-none-any.whl
- Upload date:
- Size: 5.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
82b4495a63403f2fc6bb2d65b633cf241e35dfef12d53d8646607c1762fec182
|
|
| MD5 |
8bf4d689661050b7c3366fcebe47d68c
|
|
| BLAKE2b-256 |
50d13387e2f2950f1092e2988126fdaf344a9dc5e39cc0076e84f53798c71260
|