nushell does that out of the box:
> history | get 82076
╭─────────────────┬──────────────────╮
│ start_timestamp │ 2025-06-24 16:46 │
│ command │ mpc play │
│ cwd │ /home/work │
│ duration │ 1ms │
│ exit_status │ 0 │
╰─────────────────┴──────────────────╯
It's really nice, because it doesn't just tell you time between command executions (or rather time between commands finishing), but the actual runtime duration of the command.
I love nushell. You can also query by friendlier things than index:
The syntax ends up very clean looking since the data going through the pipes is typed, and the error messages are top notch (fingers crossed hn doesn't mangle that...)