Search code examples
emacsorg-modetime-format

How to add seconds to org-mode timestamp


I added this to .emacs:

(setq org-support-shift-select t)

So, each time a TODO item is set to done, I get this:

* DONE Important task
  CLOSED: [2014-09-04 Thu 18:44]

Is it possible to add seconds to the timestamp? So I could get this:

* DONE Important task
  CLOSED: [2014-09-04 Thu 18:44:31]

This page says, that I can customize the timestamp format. But I couldn't understand, how to do it. I tried this:

(setq org-time-stamp-custom-formats '("<%m/%d/%y %a>" "<%m/%d/%y %a %H:%M:%S>"))

But it doesn't work.


Solution

  • Try this:

    (setq org-time-stamp-formats
          '("<%Y-%m-%d %a>" . "<%Y-%m-%d %a %H:%M:%S>"))
    

    Take note that it's defined as a constant, so you're not encouraged to fiddle with it (but you still can:).