bttf ==== A command line tool for datetime arithmetic, parsing, formatting and more.
Dual-licensed under MIT or the UNLICENSE.
Documentation
The [user guide] should be your first stop for understanding the high level concepts that bttf deals with. Otherwise, consult bttf --help or bttf <sub-command --help for more specific details.
Alternatively, there is a [comparison] between other similar tools that might give you a quick sense of what bttf is like.
[!TIP] This project was initially named Biff. It has been renamed to bttf.
Brief Examples
Print the current time:
$ bttf
Sat, May 10, 2025, 8:02:04 AM EDT[!TIP] If you get output like 2025 M05 10, Mon 08:02:04 instead, that's because you likely don't have [locale support][locale] support configured. Enabling locale support requires setting BTTFLOCALE in your shell environment.
Print the current time in a format of your choosing:
$ bttf time fmt -f rfc3339 now
2025-05-10T08:08:30.101066734-04:00
$ bttf time fmt -f rfc9557 now
2025-05-10T08:08:33.420946447-04:00[America/New_York]
$ bttf time fmt -f '%Y-%m-%d %H:%M:%S %Z' now
2025-05-10 08:08:48 EDTPrint multiple relative times in one command:
$ bttf time fmt -f '%c' now -1d 'next sat' 'last monday' '9pm last mon'
Sat, May 10, 2025, 10:44:39 AM EDT
Fri, May 9, 2025, 10:44:39 AM EDT
Sat, May 17, 2025, 10:44:39 AM EDT
Mon, May 5, 2025, 10:44:39 AM EDT
Mon, May 5, 2025, 9:00:00 PM EDTPrint the current time in another time zone, and round it the nearest 15 minute increment:
$ bttf time in Asia/Bangkok now | bttf time round -i 15 -s minute
2025-05-10T19:15:00+07:00[Asia/Bangkok]Add a duration to the current time:
$ bttf time add -1w now
2025-05-03T10:34:30.819577918-04:00[America/New_York]
$ bttf time add '1 week, 12 hours ago' now
2025-05-02T22:34:44.114109514-04:00[America/New_York]
$ bttf time add 6mo now
2025-11-10T10:34:49.023321635-05:00[America/New_York]