public
Created

evaluate some code at a given DateTime

  • Download Gist
do-at*.clj
Clojure
1 2 3 4 5 6 7 8 9 10
(defn do-at* [date-time f]
(DateTimeUtils/setCurrentMillisFixed (.getMillis date-time))
(try
(f)
(finally (DateTimeUtils/setCurrentMillisSystem))))
 
;; you might use this code like this:
 
(do-at* (DateMidnight. 2000 1 1)
(fn [] (DateMidnight.))) ;;=> (DateMidnight. 2000 1 1)

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.