Date format in Org mode when exporting

I export my file in org-mode to LaTeX and often use the Cc . timestamp Cc . as a top-level headline, as a kind of moving diary.

However, when it is exported to PDF, <2014-04-25 Fri> looks a little funny. Is there a general parameter that converts timestamps to some formatted date, such as Friday, April 25, 2014, or some other common datestring format?

I looked here and realized that there are several ways to enter dates, but I think there should also be formatting of the output. I also see that there is an export timestamp here ,

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

But it is not clear which implementation will mean.

+6
source share
2 answers

Try the following:

 (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)) 

Update. If you want to remove the brackets <> from the output line, you need to fix the org-translate-time function. Normal behavior:

 (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 a fixed function, for example 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 <> hardcoded in the org-translate-time function, and you cannot remove them by setting org-time-stamp-custom-formats only.

+4
source

Instead of fixing org-translate-time you can remove the brackets by adding the following function to org-export-filter-timestamp-functions :

 (defun org-export-filter-timestamp-remove-brackets (timestamp backend info) "removes relevant brackets from a timestamp" (cond ((org-export-derived-backend-p backend 'latex) (replace-regexp-in-string "[<>]\\|[][]" "" timestamp)) ((org-export-derived-backend-p backend 'html) (replace-regexp-in-string "&[lg]t;\\|[][]" "" timestamp)))) (eval-after-load 'ox '(add-to-list 'org-export-filter-timestamp-functions 'org-export-filter-timestamp-remove-brackets)) 

See http://endlessparentheses.com/better-time-stamps-in-org-export.html for more details.

+5
source

All Articles