0

I was working away in emacs using org-mode to register some task I was doing, when I noticed a new buffer had appeared called "**dates**". It had a number of dates presented in it such as "ISO date", "Gregorian", "Number of days until the end of the year", etc. Where did that come from?

Alas I had left it too late to use C-h l to see what key combination brought it up. Searching within emacs help system and google is proving futile....

2 Answers 2

1

For me, grep gives a single answer:

(defun org-agenda-convert-date ()
  (interactive)
  (org-agenda-check-type t 'agenda)
  (let ((day (get-text-property (min (1- (point-max)) (point)) 'day))
        date s)
    (unless day
      (user-error "Don't know which date to convert"))
    (setq date (calendar-gregorian-from-absolute day))
    (setq s (concat
             "Gregorian:  " (calendar-date-string date) "\n"
             "ISO:        " (calendar-iso-date-string date) "\n"
             "Day of Yr:  " (calendar-day-of-year-string date) "\n"
             "Julian:     " (calendar-julian-date-string date) "\n"
             "Astron. JD: " (calendar-astro-date-string date)
             " (Julian date number at noon UTC)\n"
             "Hebrew:     " (calendar-hebrew-date-string date) " (until sunset)\n"
             "Islamic:    " (calendar-islamic-date-string date) " (until sunset)\n"
             "French:     " (calendar-french-date-string date) "\n"
             "Bahá’í:     " (calendar-bahai-date-string date) " (until sunset)\n"
             "Mayan:      " (calendar-mayan-date-string date) "\n"
             "Coptic:     " (calendar-coptic-date-string date) "\n"
             "Ethiopic:   " (calendar-ethiopic-date-string date) "\n"
             "Persian:    " (calendar-persian-date-string date) "\n"
             "Chinese:    " (calendar-chinese-date-string date) "\n"))
    (with-output-to-temp-buffer "*Dates*"
      (princ s))
    (org-fit-window-to-buffer (get-buffer-window "*Dates*"))))
2
  • That could be it, though I am still unsure how I got there. HeHe "Gregorian" not "Jordan"...
    – alls0rts
    Oct 21, 2019 at 9:24
  • From Agenda Mode buffer (C-c a a for example) the letter C calls it up. Mystery solved. Thanks.
    – alls0rts
    Oct 21, 2019 at 9:34
2

Press C from Agenda buffer.

C runs the command org-agenda-convert-date (found in org-agenda-mode-map), which is an interactive byte-compiled Lisp function in ‘org-agenda.el’.

It is bound to C, <Calendar/Diary> .

(org-agenda-convert-date)

Dixit Emacs help

2
  • Thanks for summary, but that is the Answer given above already.
    – alls0rts
    Jan 6, 2023 at 16:24
  • 1
    As I see it, the difference is the medium (Lisp vs English). I thought it might be useful to have an explanation in English. Shall I delete my answer?
    – crocefisso
    Jan 6, 2023 at 19:48

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.