Created
February 1, 2013 13:27
-
-
Save reshefm/4691302 to your computer and use it in GitHub Desktop.
Get week of year of a date in Clojure
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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