Comment by nvilcins

4 years ago

Tangentially, I frequently add dates to filenames to keep things organized. And _always_ in the `YYYYMMDD` format for clarity and technical reasons; `DDMMYYYY` (or God forbid the Americans' `MMDDYYYY`) never made much sense to me.

I do this so often that I have an emacs macro or two that helps me out:

  (defun mdy ()
    (interactive)
    (insert (format-time-string "%04Y-%02m-%02d")))

That inserts the "proper" date format (e.g., 2021-11-11) at the current point.

Then to create a date-stamped file name:

  (defun file-mdy (file-name)
    (interactive "sbasename: ")
    (find-file (format "%s-%s.org" (format-time-string "%04Y-%02m-%02d") file-name))
    (save-buffer))

And a few others.

Nobody seems to misunderstand this date format. US folks might find it annoying, but understand what it means.