This function tells whether a given time lies within a a given time interval.
(require '[clj-time.core :as t])
(def date1 (t/date-time 2016 11 5))
(def date2 (t/date-time 2016 12 5))
(def test-date1 (t/date-time 2016 12 20))
(def test-date2 (t/date-time 2016 11 15))
(t/within? (t/interval date1 date2) test-date1) ;; false
(t/within? (t/interval date1 date2) test-date2) ;; true
The interval function is used is exclusive, which means that is does not include the second argument of the function within the interval. As an example:
(t/within? (t/interval date1 date2) date2) ;; false
(t/within? (t/interval date1 date2) date1) ;; true