月の最後の日を調べる - lisp-cookbook-ja/common-lisp GitHub Wiki

日付と時刻

月の最後の日を調べる

単純な計算によるもの。(Universal Timeで翌月の一日から24時間を引く)

(defun the-last-day-in-the-month (ut)
  (multiple-value-bind (s m h d mo y)
                       (decode-universal-time ut)
    (declare (ignore s m d h))
    (- (encode-universal-time 0 0 0 1 (1+ mo) y) 
       #.(* 24 60 60))))