Skip to content

Instantly share code, notes, and snippets.

/gist:5083422
Created Mar 4, 2013

Embed
What would you like to do?
(defn parse-date-str
"Parses str, returns a Calendar object (base format: 'yyyy-MM-dd HH:mm:ss Z')"
([str]
(parse-date-str str "yyyy-MM-dd HH:mm:ss Z"))
([str date-format]
(let [c (java.util.GregorianCalendar.)
df (java.text.SimpleDateFormat. date-format)]
(.setTime c (.parse df str)) c)))
markus.is.cool=> (doseq [n x]
#_=> (let [d (extract-time-jp-str n)]
(println d)
(println (parse-date-str d "MM/dd/yyyy HH:mm:ss"))))
03/01/2013 00:00:22:12
ParseException Unparseable date: "03/01/2013 00:00:22:12" java.text.DateFormat.parse (DateFormat.java:358)
markus.is.cool=>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.