Skip to content

Instantly share code, notes, and snippets.

Created March 4, 2013 16:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/5083422 to your computer and use it in GitHub Desktop.
Save anonymous/5083422 to your computer and use it in GitHub Desktop.
(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