I wish good luck to all those who want to solve their problems without their participation by using ChatGPT or similar AI code generation tools. As I've said before, I personally am not interested in using my own added participation to make these things work. People could make work for me every time they decide to type in a query and send the forum a message.
Still, I'm interested in the problems users want to be solved, and if I can help, as always, I'll do so. In this case, ChatGPT got 1 of the 3 statements it generated more of less correct, though that's only part of the solution.
A trigger can help in this, but a JavaScript field should probably be enough. When you add the JavaScript field, note the following option: Execute script in real time. Here's what the wiki says about this option...
A script can be executed both when an entry is created or changed and when it is displayed.
The time of script execution is set by the toggle button Execute script real time on the field edit screen.
It is reasonable to enable this option if your script contains functions that depend on the current time.
Online execution in case of a large number of entries can significantly increase the time required to open the library.Turn this option on.
I believe this will give you what you want if the script you use is...
new Date();