7

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?

  • 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. – Kaushal Modi Jan 27 '16 at 4:56
  • 1
    Actually org-display-custom-times and org-time-stamp-custom-formats might be the variables designed for user to tweak. – Kaushal Modi Jan 27 '16 at 5:08
7

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.

  • @KaushalModi, thanks for the highlighting! I wasn't sure how to do that! – elethan Jan 27 '16 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. – Kaushal Modi Jan 27 '16 at 18:38

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.