Created
August 16, 2016 18:53
-
-
Save abarnash/b0af4fb323748f0177268f0e4a412ecb to your computer and use it in GitHub Desktop.
Converts an ISO duration string to Millisecond value 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
(ns duration-to-ms) | |
(defn string->millis [duration-str] | |
(.getMillis (.toStandardDuration (org.joda.time.Period. duration-str)))) | |
;; Example | |
;;=> (string->millis "PT8M56S") | |
;;53600 | |
;;=> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment