Function: math-day-in-year

math-day-in-year is a byte-compiled function defined in calc-forms.el.gz.

Signature

(math-day-in-year YEAR MONTH DAY &optional JULIAN)

Documentation

Return the number of days of the year up to YEAR MONTH DAY.

The count includes the given date. If JULIAN is non-nil, use the Julian calendar, otherwise use the Gregorian calendar.

Source Code

;; Defined in /usr/src/emacs/lisp/calc/calc-forms.el.gz
(defun math-day-in-year (year month day &optional julian)
  "Return the number of days of the year up to YEAR MONTH DAY.
The count includes the given date.
If JULIAN is non-nil, use the Julian calendar, otherwise
use the Gregorian calendar."
  (let ((day-of-year (+ day (* 31 (1- month)))))
    (if (> month 2)
	(progn
	  (setq day-of-year (- day-of-year (/ (+ 23 (* 4 month)) 10)))
	  (if (math-leap-year-p year julian)
	      (setq day-of-year (1+ day-of-year)))))
    day-of-year))