19.3.6 Updating Time Stamps Automatically

You can arrange to put a time stamp in a file, so that it is updated automatically each time you edit and save the file. The time stamp must be in the first eight lines of the file, and you should insert it like this:

Time-stamp: <>

or like this:

Time-stamp: " "

Then add the function time-stamp to the hook before-save-hook (see Hooks). When you save the file, this function then automatically updates the time stamp with the current date and time. You can also use the command M-x time-stamp to update the time stamp manually. By default the time stamp is formatted according to your locale setting (see Environment Variables) and time zone (see Time of Day in The Emacs Lisp Reference Manual). For customizations, see the Custom group time-stamp.