Function: calendar-islamic-from-absolute

calendar-islamic-from-absolute is a byte-compiled function defined in cal-islam.el.gz.

Signature

(calendar-islamic-from-absolute DATE)

Documentation

Compute the Islamic date (month day year) corresponding to absolute DATE.

The absolute date is the number of days elapsed since the (imaginary) Gregorian date Sunday, December 31, 1 BC.

Source Code

;; Defined in /usr/src/emacs/lisp/calendar/cal-islam.el.gz
       (1- calendar-islamic-epoch)))) ; days before start of calendar

(defun calendar-islamic-from-absolute (date)
  "Compute the Islamic date (month day year) corresponding to absolute DATE.
The absolute date is the number of days elapsed since the (imaginary)
Gregorian date Sunday, December 31, 1 BC."
  (if (< date calendar-islamic-epoch)
      (list 0 0 0)                      ; pre-Islamic date
    (let* ((approx (/ (- date calendar-islamic-epoch)
                      355))  ; approximation from below
           (year             ; search forward from the approximation
            (+ approx
               (calendar-sum y approx
                             (>= date (calendar-islamic-to-absolute
                                       (list 1 1 (1+ y))))
                             1)))
           (month                       ; search forward from Muharram
            (1+ (calendar-sum m 1
                              (> date
                                 (calendar-islamic-to-absolute
                                  (list m
                                        (calendar-islamic-last-day-of-month
                                         m year)
                                        year)))
                              1)))
           (day                    ; calculate the day by subtraction
            (- date
               (1- (calendar-islamic-to-absolute (list month 1 year))))))
      (list month day year))))