Emacs dired how to set date/time format
Frage
Now dired writes the last access date/time in the following format:
Jun 20 14:22
How to make it write:
20.06.2012 14:22
Lösung
one of these options:
1 you can set the appropriate variables.
(setq ls-lisp-format-time-list '("%d.%m.%Y %H:%M" "%d.%m.%Y %H:%M") ls-lisp-use-localized-time-format t)
explanation: The ls-lisp-format-time-list
is a list of two format strings, which work as they do with the format-time-string
function. There are two, because by default emacs is set up to display "recent" files with a higher-resolution timestamp than "older" files, where the recent vs older threshold is 6 months (I think). The first is the format used for recent files; the latter is for older files.
I never liked the default behavior; I just want the files to be displayed the same way. So I set the list to use the same time format for newer and older files.
2 You can redefine the function ls-lisp-format-time
.
For example, if I do this:
(defun ls-lisp-format-time (file-attr time-index now)
"################")
Then dired looks like this:
The original definition of the function is in ls-lisp.el.