One might set PROMPT_COMMAND to accomplish this goal as follows or in a myriad of other ways.
export PROMPT_COMMAND='echo -e $(history 1 | sed "s/^[ ]*[0-9]\+[ ]*//")\\t$(date)\\t$(pwd) >> $HOME/history.csv'
The file could be opened as a CSV file with a custom field separator (TAB). The character is produced with the -e switch to the builtin echo command which "enable[s] interpretation of backslash escapes."
$(history 1 | sed "s/^[ ]*[0-9]\+[ ]*//") : In Linux, get the last command w/o command number, and w/o white space surrounding the command number.
$(date): Get the current date and time.
$(pwd): Get the current working directory.
>> $HOME/history.csv: Append (>>) the output to a file.
This produces output such as the following line, if ls -la were executed from $HOME (of username).
ls -la Tue May 14 12:00:36 EDT 2019 /home/username