Last active
June 11, 2020 07:11
-
-
Save aoba17/621af0b2a9bae1d066da70e164614eb5 to your computer and use it in GitHub Desktop.
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
(def dt-a (js/Date. "2020-05-01")) | |
(def dt-b (js/Date. "2020-05-30")) | |
(def mills<->days (* 1000 60 60 24)) | |
(defn get-duration | |
"2つの日付の差分(日数)を求める" | |
[dt-a dt-b] | |
(/ (- dt-b dt-a) mills<->days)) | |
(get-duration dt-a dt-b) ;-> 29 | |
(def today | |
"今日の日付" | |
(let [now (js/Date.) | |
year (.getFullYear now) | |
month (inc (.getMonth now)) | |
date (.getDate now)] | |
(js/Date. (str year "/" month "/" date)))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment