Function: org-insert-timestamp

org-insert-timestamp is a byte-compiled function defined in org.el.gz.

Signature

(org-insert-timestamp TIME &optional WITH-HM INACTIVE PRE POST EXTRA)

Documentation

Insert a date stamp for the date given by the internal TIME.

See format-time-string for the format of TIME. WITH-HM means use the stamp format that includes the time of the day. INACTIVE means use square brackets instead of angular ones, so that the stamp will not contribute to the agenda. PRE and POST are optional strings to be inserted before and after the stamp. The command returns the inserted time stamp.

Aliases

org-insert-time-stamp

Source Code

;; Defined in /usr/src/emacs/lisp/org/org.el.gz
(defun org-insert-timestamp (time &optional with-hm inactive pre post extra)
  "Insert a date stamp for the date given by the internal TIME.
See `format-time-string' for the format of TIME.
WITH-HM means use the stamp format that includes the time of the day.
INACTIVE means use square brackets instead of angular ones, so that the
stamp will not contribute to the agenda.
PRE and POST are optional strings to be inserted before and after the
stamp.
The command returns the inserted time stamp."
  (org-fold-core-ignore-modifications
    (let ((fmt (org-time-stamp-format with-hm inactive))
	  stamp)
      (insert-before-markers-and-inherit (or pre ""))
      (when (listp extra)
        (setq extra (car extra))
        (if (and (stringp extra)
                 (string-match "\\([0-9]+\\):\\([0-9]+\\)" extra))
	    (setq extra (format "-%02d:%02d"
                                (string-to-number (match-string 1 extra))
                                (string-to-number (match-string 2 extra))))
	  (setq extra nil)))
      (when extra
        (setq fmt (concat (substring fmt 0 -1) extra (substring fmt -1))))
      (insert-before-markers-and-inherit (setq stamp (format-time-string fmt time)))
      (insert-before-markers-and-inherit (or post ""))
      (setq org-last-inserted-timestamp stamp))))