Function: calendar-nth-named-absday

calendar-nth-named-absday is a byte-compiled function defined in calendar.el.gz.

Signature

(calendar-nth-named-absday N DAYNAME MONTH YEAR &optional DAY)

Documentation

Absolute date of the Nth DAYNAME after/before MONTH YEAR DAY.

A DAYNAME of 0 means Sunday, 1 means Monday, and so on. If N>0, return the Nth DAYNAME after MONTH DAY, YEAR (inclusive). If N<0, return the Nth DAYNAME before MONTH DAY, YEAR (inclusive). DAY defaults to 1 if N>0, and MONTH's last day otherwise.

Source Code

;; Defined in /usr/src/emacs/lisp/calendar/calendar.el.gz
(defun calendar-nth-named-absday (n dayname month year &optional day)
  "Absolute date of the Nth DAYNAME after/before MONTH YEAR DAY.
A DAYNAME of 0 means Sunday, 1 means Monday, and so on.
If N>0, return the Nth DAYNAME after MONTH DAY, YEAR (inclusive).
If N<0, return the Nth DAYNAME before MONTH DAY, YEAR (inclusive).
DAY defaults to 1 if N>0, and MONTH's last day otherwise."
  (if (> n 0)
      (+ (* 7 (1- n))
         (calendar-dayname-on-or-before
          dayname
          (+ 6 (calendar-absolute-from-gregorian
                (list month (or day 1) year)))))
    (+ (* 7 (1+ n))
       (calendar-dayname-on-or-before
        dayname
        (calendar-absolute-from-gregorian
         (list month
               (or day (calendar-last-day-of-month month year))
               year))))))