Convenience function add-years

This commit is contained in:
Sudhir Shenoy 2017-07-15 08:38:52 +09:00
parent f6dd1f2d90
commit 9bb852795e

View file

@ -92,6 +92,10 @@ the month is returned."
"Retreat date by given number of days" "Retreat date by given number of days"
(- date days)) (- date days))
(defun add-years (date years &key eom-rule)
"Add number of years to date (subtract if negative) - see add-months"
(add-months date (* 12 years) :eom-rule eom-rule))
(defun add-months (date months &key eom-rule) (defun add-months (date months &key eom-rule)
"Add number of months to date (negative number will decrement date). "Add number of months to date (negative number will decrement date).
The returned date will have the same day as the given date unless that is not a valid The returned date will have the same day as the given date unless that is not a valid
@ -291,4 +295,3 @@ Supported day conventions are:
(when (= d1 31) (when (= d1 31)
(setf d1 30)) (setf d1 30))
(/ (+ (- d2 d1) (* 30 (- m2 m1)) (* 360 (- y2 y1))) 360)))))) (/ (+ (- d2 d1) (* 30 (- m2 m1)) (* 360 (- y2 y1))) 360))))))