bttf: datetime arithmetic in the terminal, done right

bttf: datetime arithmetic in the terminal, done right

bttf (BurntSushi/bttf, Rust, MIT, v0.1.4) is a datetime Swiss army knife for the terminal by the author of ripgrep and fd. Its tag/untag mechanic rewrites timestamps in arbitrary log streams in-place — a pipeline capability absent from date, dateutils, and similar tools. Landed on HN with 175 points and 98 comments on May 28.

CLI Tool Pick
2026/5/31 · 1:19
2 订阅 · 12 内容
You have a log file full of UTC timestamps. You need them in local time, inline, without disrupting the surrounding text. So you write 30 lines of awk or paste the thing into Python, pull your hair out over DST edge cases, and accept that 2024-03-10T02:30:00Z will quietly become something wrong after the clocks change.
That's the exact problem bttf was built for — and the solution it provides is more composable than anything date, dateutils, or a quick python -c can give you.
bttf (short for Back to the Future, previously named Biff) is a Rust CLI for datetime arithmetic, formatting, timezone conversion, and log-timestamp manipulation. 1 It shipped v0.1.4 on May 28 and landed on Hacker News the same day, where it collected 175 points and 98 comments — a thread worth reading on its own. 2 The rename from Biff happened that same day via PR #14, after multiple HN commenters flagged that biff is already a classic Unix mail-notification command dating back to the 1980s.
正在加载内容卡片…
The author is Andrew Gallant, aka BurntSushi — the same person who wrote ripgrep and fd. 1 That's not incidental. His tools are known for being correct, fast, and staying maintained.
正在加载内容卡片…

Install

Three paths, depending on your setup 1 3:
# Option 1: compile from crates.io
cargo install bttf

# Option 2: prebuilt binary (macOS, Linux, Windows)
# Download from https://github.com/BurntSushi/bttf/releases
# v0.1.4 ships 28 binary assets across architectures

# Option 3: Arch Linux AUR
yay -S bttf
No Homebrew formula exists yet. 4 One HN commenter said flat-out that a tool without a package manager entry "basically doesn't exist" — that's a reasonable frustration, but the prebuilt binaries on the Releases page are static and drop in without any runtime dependencies. Download, chmod +x, put it in your PATH.
One gotcha on locale: if you compile with cargo install bttf (no flags), natural language month names won't render — you'll see M05 instead of May. 5 The prebuilt binaries include locale support by default. If compiling, add --features locale and set BTTF_LOCALE in your shell:
cargo install bttf --features locale
export BTTF_LOCALE=en-US   # or your locale

What it does

bttf covers the standard datetime toolkit — format conversion, timezone math, duration arithmetic — but with a type distinction that most tools quietly get wrong.
HN user jibaoproxy put it well: "The thing Biff gets right that gnu date and most stdlib datetime APIs get wrong: it treats 'civil time' and 'absolute instants' as different types." 6 The practical payoff: when you add one month to a civil time (a calendar date in a timezone), you get a month later on the same clock. When DST shifts happen in between, bttf handles the arithmetic correctly without silently picking the wrong disambiguation.
Under the hood, bttf is a CLI front-end for BurntSushi's Jiff library, which provides the datetime logic and IANA timezone database. 1 The tool builds against Rust 1.93+ and ships as a single static binary — no runtime, no config files.
Feature set at v0.1.4:
SubcommandWhat it does
bttf time fmtFormat timestamps (strftime, RFC 3339, RFC 9557, and more)
bttf time inConvert timestamps between timezones (full IANA database)
bttf time add / subCalendar and absolute duration arithmetic
bttf time seqGenerate date/time sequences (RFC 5545 recurrence rules)
bttf time sortSort a stream of timestamps
bttf tag / untagWrap/unwrap datetime strings in arbitrary text as JSON lines
bttf durParse and round durations
The time seq command already has a fan. One HN commenter noted that bttf time seq monthly -w 2-tue would have replaced roughly 40 lines of bash they'd written for a newsletter scheduling script. 7

The pipeline mechanic that nothing else does

bttf tag and bttf untag are the feature that sets bttf apart from date and dateutils. Here's the problem they solve:
You have a server log. Every line has a UTC timestamp somewhere in it. You want all those timestamps converted to your local timezone, in-place, with the rest of each line intact. With standard tools, you're parsing the log yourself. With bttf:
bttf tag lines access.log \
  | bttf time in system \
  | bttf time fmt -f '%c' \
  | bttf untag -s
bttf tag scans each line, wraps every datetime string it recognizes as a JSON object, and passes the stream forward. bttf time in system converts each wrapped timestamp to the local timezone. bttf time fmt reformats it. bttf untag stitches the converted timestamps back into the original lines and prints clean text. The file's structure is preserved; only the timestamps change.
BurntSushi said he's uncertain how broadly useful people will find this feature, "but other datetime utilities don't seem to have it." 1 Neither dateutils nor GNU date has an equivalent in their comparison docs. 8

The LLM question

The HN thread had one notable counterpoint: Ferret7446 argued that "this kind of tool has been completely obsoleted by LLMs (even local models)." 9 Several commenters agreed that they'd sooner paste a timestamp into ChatGPT than install a new CLI.
BurntSushi's response was honest rather than defensive: "Quite plausible. I built most of it in May 2025 (1 year ago) before I even looked at LLMs for coding." He then added: "Jiff has not been obsoleted by LLMs and is exactly the sort of thing an LLM would add as a dependency to a Rust project." 10
正在加载内容卡片…
The honest answer: for one-off conversions, an LLM is probably faster. For piping through logs, scripting scheduled sequences, or embedding datetime operations in shell pipelines, bttf has a clearer contract and doesn't require a round-trip to a model. The tag/untag mechanic in particular doesn't have an obvious LLM equivalent that keeps your log lines intact.

Caveats

  • No Homebrew yet. Prebuilt binaries work, but the install friction is real for macOS users who expect brew install to just work. Watch the repo for a community-submitted formula.
  • Locale flag required at compile time. If you install via cargo install bttf without --features locale, natural language output will be ugly. The prebuilt binaries sidestep this, but it's a sharp edge for source builds.
  • 636 stars, 39 commits, v0.1.4. The tool is new. The author has a strong track record, but the API is not frozen and edge cases will surface. That said, this mirrors exactly where ripgrep and fd were in their early weeks.
  • No cargo-binstall support yet. 11 One more install option that would remove friction for Rust users without a full toolchain.

Verdict

If your work touches log analysis, date arithmetic in shell scripts, or timezone-aware scheduling, bttf earns a cargo install today. The tag/untag pipeline fills a gap that dateutils and GNU date explicitly don't cover — per the project's own comparison docs. The time seq recurrence engine replaces a category of one-off bash scripts. The type-correct DST handling is the kind of thing you appreciate only after it saves you from a subtle bug at 2 AM.
The LLM objection is worth taking seriously for simple one-off conversions. For anything that belongs in a pipeline or a script, bttf has the better answer.
Try it: bttf time now → current timestamp in RFC 3339. bttf time in America/New_York → pipe a timestamp and get it in NYC time. Start there.

围绕这条内容继续补充观点或上下文。

  • 登录后可发表评论。