Last active
December 18, 2015 23:19
-
-
Save gdeer81/5860992 to your computer and use it in GitHub Desktop.
The Year as data
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
(ns 'gist.core | |
(:use [clj-time | |
[core] | |
[local] | |
[predicates]])) | |
;;create date objects for all 365 days of 2013 | |
(def all-days | |
(for [month (range 1 13) | |
day (case month | |
2 (range 1 29) | |
(4 6 9 11) (range 1 31) | |
(1 3 5 7 8 10 12) (range 1 32))] | |
(date-time 2013 month day))) | |
;; | |
(def bean-days (map bean all-days)) | |
(first all-days) ;;=> #<DateTime 2013-01-01T00:00:00.000Z> | |
(first bean-days) ;;=> {:hourOfDay 0, :zone #<FixedDateTimeZone UTC>, :yearOfEra 2013, :dayOfMonth 1, | |
;; :yearOfCentury 13, :minuteOfDay 0, :millis 1356998400000, :millisOfSecond 0, | |
;; :class org.joda.time.DateTime, :secondOfMinute 0, :centuryOfEra 20, | |
;; :minuteOfHour 0, :secondOfDay 0, :weekyear 2013, :weekOfWeekyear 1, :year 2013, | |
;; :afterNow false, :chronology #<ISOChronology ISOChronology[UTC]>, :beforeNow true, | |
;; :era 1, :monthOfYear 1, :equalNow false, :millisOfDay 0, :dayOfYear 1, :dayOfWeek 2} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment