Hello people.
I've created date-clj, a date/time library for clojure.
I know there's clj-time already but I was thinking about something
less javaish and more like date.js.
Some examples:
(date :day 25 :month :november :year 2000)
-> #<Date Sat Nov 25 00:00:00 BRST 2000>
(-> (today) (set-date :month :december :year 1900))
-> #<Date Sat Dec 29 16:44:33 BRST 1900>
(from-now 1 :year 5 :days)
-> #<Date Wed Jul 04 16:44:33 BRST 2012>
(back 1 :month 200 :minutes)
-> #<Date Sun May 29 13:26:33 BRST 2011>
(following :friday)
-> #<Date Fri Jul 01 16:47:17 BRST 2011>
(-> (today) (is? :friday 13))
-> false
(-> (back 3 :days) (was? :sunday))
-> true
(-> (april) sundays first)
-> #<Date Sun Apr 03 00:00:00 BRST 2011>
(-> (following :month) fridays last)
-> #<Date Fri Jul 29 00:00:00 BRST 2011>
(monday)
-> #<Date Mon Jun 27 00:00:00 BRST 2011>
(binding [*locale* (Locale/GERMAN)] (names :week-days))
-> ("Sontag" "Montag" "Dienstag" "Mittwoch" "Donnerstag" "Freitag"
"Samstag")
The project page is: http://github.com/stackoverflow/date-clj
Critics and ideas are welcome =)
Regards,
Islon
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your
first post.
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en