datetimeemacsorg-mode

Org mode timestamp format when exported


I'm exporting my org-mode file to LaTeX, and often use the C-c . timestamp as a top level heading as sort of a rolling diary.

However, when it exports to PDF, <2014-04-25 Fri> looks a little funny. Is there a general setting that would convert the timestamps to some kind of formatted date, like "Friday, April 25, 2014" or some other kind of common datestring format?

I looked here and understand that there are a couple ways of entering dates, but I imagine there must be output formatting, too. I see also that there is an export timestamp setting here,

<:
Toggle inclusion of any time/date active/inactive stamps (org-export-with-timestamps). 

But am unclear on what implementation would mean.


Solution

  • Try this:

    (let ((org-time-stamp-custom-formats
           '("<%A, %B %d, %Y>" . "<%A, %B %d, %Y %H:%M>"))
          (org-display-custom-times 't))
      (org-latex-export-to-latex))
    

    Upd.: If you want to remove brackets <> from output string, you have to patch the function org-translate-time. Normal behaviour:

    (let ((org-time-stamp-custom-formats
           '("<%A, %B %d, %Y>" . "<%A, %B %d, %Y %H:%M>"))
          (org-display-custom-times 't))
      (org-translate-time "<2014-04-29 Tu.>")) => "<Tuesday, April 29, 2014>"
    

    With patched function like here https://gist.github.com/boykov/11387660

    (let ((org-time-stamp-custom-formats
           '("<%A, %B %d, %Y>" . "<%A, %B %d, %Y %H:%M>"))
          (org-display-custom-times 't))
      (org-translate-time "<2014-04-29 Tu.>")) => "Tuesday, April 29, 2014"
    

    The brackets <> are hardcoded in the function org-translate-time and you can't remove their by fixing org-time-stamp-custom-formats only.