Skip to content

Instantly share code, notes, and snippets.

@reshefm
Created February 1, 2013 13:27
Show Gist options
  • Save reshefm/4691302 to your computer and use it in GitHub Desktop.
Save reshefm/4691302 to your computer and use it in GitHub Desktop.
Get week of year of a date in Clojure
(require '[clj-time.core :as tm])
(import '(java.util Calendar))
(defn week-of-year
[date]
(let [cal (Calendar/getInstance)]
(.setTime cal (.toDate date))
(.get cal Calendar/WEEK_OF_YEAR)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment