指定の日付が存在するかどうか調べる - lisp-cookbook-ja/common-lisp GitHub Wiki

日付と時刻

Common Lispの標準に該当する関数はありませんので自作するかライブラリを利用することになるでしょう。

(defun date-exist-p (y m d)
  (let ((ut (encode-universal-time 0 0 0 d m y)))
   (multiple-value-bind (ig no re d2 m2 y2)
                        (decode-universal-time ut)
     (declare (ignore ig no re))
     (and (= y y2)
          (= d d2)
          (= m m2)
          ut))))

上記の例では、一度universal timeにエンコードし、再度デコードした結果が、与えられたものと一致した場合、真(universal time)を返します。

(date-exist-p 1900 2 29)
;=>  NIL

(date-exist-p 2000 2 29)
;=>  3160738800

(date-exist-p 2012 2 29)
;=>  3539430000

(date-exist-p 2013 2 29)
;=>  NIL