The history command tells you what you ran, but not when. That’s the bit I usually want to know on a server: did that docker compose pull happen before the problems started, or after? Bash can keep the time for you, it just doesn’t do it out of the box.
Set one variable in your ~/.bashrc:
export HISTTIMEFORMAT='%F %T '
The value is a strftime format. %F is the date as year-month-day and %T is the time in 24-hour notation, which is what we use here in the Netherlands anyway. The two spaces at the end keep the time stamp away from the command. Open a new shell, run a few commands, and history looks like this:
$ history | tail -3
512 2026-11-27 14:02:11 docker compose pull
513 2026-11-27 14:02:48 docker compose up -d
514 2026-11-27 14:03:05 history | tail -3
With the variable set, bash also writes the time stamps into your history file as extra comment lines, so they survive a logout and show up again in the next session. You can combine it with grep to answer questions like when you last touched a certain container: history | grep 'compose up'.
One caveat: it only works from the moment you set it. Commands that were already in your history file have no time stamp saved, so don’t trust the times bash shows next to those older lines. And the format is only for display, so you can change it later without losing anything. If you prefer seconds since 1970 for a script, %s works too.
Further reading: bash(1) manual page, strftime(3) manual page