12

Hello I am new to Emacs and I have started using org mode for improving my productivity.

Currently when I press C-c . the date format displayed is <2016-01-26 Thu> I would like to change it to <Thu Jan 26th 2016>

How do I make the corresponding changes in my .emacs?

2
  • 1
    Check out C-h v org-time-stamp-formats and C-h f format-time-string. AFAIK, there isn't a built-in way to suffix the likes of st, nd, rd, th after the dates. Without those suffixes, the answer is easy. Update: Well, looks like there is a way to add those ordinal suffixes. Commented Jan 27, 2016 at 4:56
  • 2
    Actually org-display-custom-times and org-time-stamp-custom-formats might be the variables designed for user to tweak. Commented Jan 27, 2016 at 5:08

1 Answer 1

15

You can start with something like this:

(setq-default org-display-custom-times t)
(setq org-time-stamp-custom-formats '("<%a %b %e %Y>" . "<%a %b %e %Y %H:%M>"))

This will give you <Thu Jan 26 2016> for date timestamps or <Thu Jan 26 2016 11:30> for timestamps with times. If you want zero-padded dates instead of blank-padded dates use %d instead of %e above (e.g., if you want 09 instead of 9, but I figured blank-padded would be better if you figure out a way to add the ordinal suffix). For a comprehensive list of the formatting symbols, see here. You can try to combine this with the solution here as suggested by @KaushalModi, but I haven't gotten that to work yet.

Also, if you use custom timestamps in org-mode, be aware that there are sometimes undesired side-effects: see this question and answer and this page from the org manual.

2
  • @KaushalModi, thanks for the highlighting! I wasn't sure how to do that!
    – elethan
    Commented Jan 27, 2016 at 18:35
  • 1
    You are welcome! Just for reference for anyone else, put <!-- language: lang-el --> followed by a blank line at the top of a code block. If you have only elisp code blocks but many of them, you can put just one <!-- language-all: lang-el --> at the top of the post. Commented Jan 27, 2016 at 18:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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