Not quite what you wanted, but you can get bash to add timestamps to each line in the history
automatically. Simply set, for youyour example:
HISTTIMEFORMAT="%d%b%y%T "
You getThe history command with no arguments will then show your history entries like this:
07Jul150923Jul1515:0748:0714 ls -ld .
The history -w command however always writes the history file in the internal format of:
#1437659315
ls -ld .
i.e. on 2 lines, the first line holds the time in seconds "since the epoch" (i.e. 1 jan 1970)
with a # in front so that it will not be confused with a command.