Function: math-prev-weekday-in-month

math-prev-weekday-in-month is a byte-compiled function defined in calc-forms.el.gz.

Signature

(math-prev-weekday-in-month DATE DT DAY WDAY)

Source Code

;; Defined in /usr/src/emacs/lisp/calc/calc-forms.el.gz
;;; Compute the day (1-31) of the WDAY (0-6) on or preceding the given
;;; day of the given month.
(defun math-prev-weekday-in-month (date dt day _wday)
  (or day (setq day (nth 2 dt)))
  (if (> day (math-days-in-month (car dt) (nth 1 dt)))
      (setq day (math-days-in-month (car dt) (nth 1 dt))))
  (let ((zeroth (math-sub (math-floor date) (nth 2 dt))))
    (math-sub (nth 1 (calcFunc-newweek (math-add zeroth day))) zeroth)))