I cloned such a template

(add-to-list 'org-capture-templates
             '("d" "Diary"
               entry (file "~/ORG/src/diary.org")
               "* %u \n** Log\n\n*** Tasks\n\n** Creating Writing" ;;heading必须要紧跟在\n\n后面.
               :empty-lines 1

It display the timestamp as

[2019-07-09 Tue]
** Log

** Creative Writing 

How could re-format the timestamp as

Tue Jul-09

I typed C-h v (aka M-x describe-variable) and then org-capture-templates .... A cursory review of the doc-string led me to an interesting entry as follows: "%<...> The result of format-time-string on the ... format specification." So, now we can look up the function format-time-string -- C-h f (aka M-x describe-function) and see how to customize the output ...

Here is a snippet of a component of my customization of org-capture-templates:

DEADLINE: <%<%Y-%m-%d %a>>

which gives me ... DEADLINE: <2019-07-08 Mon> ... assuming that is the current date when creating the task/event.

  • changed it to ` "* <%a %b-%d\n>** Log\n\n*** Tasks\n\n** Creative w", but it does not work. – Algebra Jul 9 at 3:06
  • 1
    Does this work?: <%<%a %b-%d>>\n – lawlist Jul 9 at 3:22
  • amazing , it works perfectly. – Algebra Jul 9 at 4:26
  • 1
    The org-capture.el library uses a hard-coded regular expression matching forms described in the doc-string of org-capture-templates -- in older versions of org-mode, the regexp looks like "%<\\([^>\n]+\\)>" and "%\\([tTuUaliAcxkKInfF]\\)". In newer versions of org-mode, the regexp looks like "%\\(:[-a-za-z]+\\|<\\([^>\n]+\\)>\\|[aAcfFikKlntTuUx]\\)". By using a particular format when customizing org-capture-templates that will match the hard-coded regexp in org-capture.el, the desired result can be achieved .... – lawlist Jul 9 at 4:49
  • ty for the detailed tutorial. – Algebra Jul 9 at 6:05

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.