0

Currently, clocking time format is this:

    CLOCK: [2021-01-12 Tue 22:45]--[2021-01-12 Tue 23:23] =>  0:38
    CLOCK: [2021-01-12 Tue 16:29]--[2021-01-12 Tue 17:08] =>  0:39

Can I change this instead to the AM/PM 12-hour format that I have grown up with?

I looked for the answer online, and I found this good question/answer as a reference: https://stackoverflow.com/questions/22720526/set-clock-table-duration-format-for-emacs-org-mode

I am using org-version 9.3 and emacs-version 27.1. Apparently for org versions 9.1 and above:

(setq org-duration-format (quote h:mm))

the above variable, org-duration-format is to be used. However, I cannot find documentation on how to change this to 12 hour AM/PM format.

The equivalent in elisp string formatting would be "%I:%M %p". However, org-duration-format does not accept string values. The online documentation for formatting time in elisp can be found here.

1
  • org-duration-format is for durations, not for times, so the duration format has nothing to do with an AM/PM specification. – NickD Jan 13 at 20:30
0

Org mode uses ISO 8601 timestamps, so you cannot use the 12-hour AM/PM format as a storage format: Org mode files will always use the 24-hour format.

However, you can change the appearance of a timestamp in an emacs buffer by using the variables org-display-custom-times and org-time-stamp-custom-formats. That is described in the Custom time format section of the manual. You lose some functionality by doing this, so it is important to read that section and understand the trade-offs.

If you do decide to go ahead with it, you need to add something like this to your init file:

(setq org-display-custom-times t)
(setq org-time-stamp-custom-formats '("<%m/%d/%y %a>" . "<%m/%d/%y %a %I:%M %p>"))

or use the Customize interface to set them. Reading the doc strings of these variables (e.g. C-h v org-display-custom-times RET) is always a good idea.

If you only want it for some files, then don't set org-display-custom-times globally; just set org-time-stamp-custom-formats and then use

#+STARTUP: customtime
...

at the top of your Org mode file.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.