Function: org-time-stamp-format

org-time-stamp-format is a byte-compiled function defined in org.el.gz.

Signature

(org-time-stamp-format &optional WITH-TIME INACTIVE CUSTOM)

Documentation

Get timestamp format for a time string.

The format is based on org-timestamp-formats (if CUSTOM is nil) or or org-timestamp-custom-formats (if CUSTOM if non-nil).

When optional argument WITH-TIME is non-nil, the timestamp will contain time.

When optional argument INACTIVE is nil, format active timestamp. When no-brackets, strip timestamp brackets. Otherwise, format inactive timestamp.

Source Code

;; Defined in /usr/src/emacs/lisp/org/org.el.gz
(defun org-time-stamp-format (&optional with-time inactive custom)
  "Get timestamp format for a time string.

The format is based on `org-timestamp-formats' (if CUSTOM is nil) or or
`org-timestamp-custom-formats' (if CUSTOM if non-nil).

When optional argument WITH-TIME is non-nil, the timestamp will contain
time.

When optional argument INACTIVE is nil, format active timestamp.
When `no-brackets', strip timestamp brackets.
Otherwise, format inactive timestamp."
  (let ((format (funcall
                 (if with-time #'cdr #'car)
                 (if custom
                     org-timestamp-custom-formats
                   org-timestamp-formats))))
    ;; Strip brackets, if any.
    (when (or (and (string-prefix-p "<" format)
                   (string-suffix-p ">" format))
              (and (string-prefix-p "[" format)
                   (string-suffix-p "]" format)))
      (setq format (substring format 1 -1)))
    (pcase inactive
      (`no-brackets format)
      (`nil (concat "<" format ">"))
      (_ (concat "[" format "]")))))