Function: org-time-string-to-absolute

org-time-string-to-absolute is a byte-compiled function defined in org.el.gz.

Signature

(org-time-string-to-absolute S &optional DAYNR PREFER BUFFER POS)

Documentation

Convert time stamp S to an absolute day number.

If DAYNR in non-nil, and there is a specifier for a cyclic time stamp, get the closest date to DAYNR. If PREFER is past (respectively future) return a date past (respectively after) or equal to DAYNR.

POS is the location of time stamp S, as a buffer position in BUFFER.

Diary sexp timestamps are matched against DAYNR, when non-nil. If matching fails or DAYNR is nil, org-diary-sexp-no-match is signaled.

Source Code

;; Defined in /usr/src/emacs/lisp/org/org.el.gz
(defun org-time-string-to-absolute (s &optional daynr prefer buffer pos)
  "Convert time stamp S to an absolute day number.

If DAYNR in non-nil, and there is a specifier for a cyclic time
stamp, get the closest date to DAYNR.  If PREFER is
`past' (respectively `future') return a date past (respectively
after) or equal to DAYNR.

POS is the location of time stamp S, as a buffer position in
BUFFER.

Diary sexp timestamps are matched against DAYNR, when non-nil.
If matching fails or DAYNR is nil, `org-diary-sexp-no-match' is
signaled."
  (cond
   ((string-match "\\`%%\\((.*)\\)" s)
    ;; Sexp timestamp: try to match DAYNR, if available, since we're
    ;; only able to match individual dates.  If it fails, raise an
    ;; error.
    (if (and daynr
	     (org-diary-sexp-entry
	      (match-string 1 s) "" (calendar-gregorian-from-absolute daynr)))
	daynr
      (signal 'org-diary-sexp-no-match (list s))))
   (daynr (org-closest-date s daynr prefer))
   (t (time-to-days
       (condition-case errdata
	   (org-time-string-to-time s)
	 (error (error "Bad timestamp `%s'%s\nError was: %s"
		       s
		       (if (not (and buffer pos)) ""
			 (format-message " at %d in buffer `%s'" pos buffer))
		       (cdr errdata))))))))