Blame


1 ddc03123 2020-03-28 op (ns blog.time
2 ddc03123 2020-03-28 op (:import (java.time.format DateTimeFormatter FormatStyle)
3 ddc03123 2020-03-28 op (java.time LocalDate)
4 4f9bd2e2 2020-03-30 op (java.util Locale Date)))
5 ddc03123 2020-03-28 op
6 ddc03123 2020-03-28 op (def pattern
7 ddc03123 2020-03-28 op (DateTimeFormatter/ofPattern "yyyy/MM/dd"))
8 ddc03123 2020-03-28 op
9 ddc03123 2020-03-28 op (def loc (Locale/forLanguageTag "en"))
10 ddc03123 2020-03-28 op
11 ddc03123 2020-03-28 op (def pattern-loc
12 ddc03123 2020-03-28 op (DateTimeFormatter/ofPattern "dd MMMM yyy" loc))
13 ddc03123 2020-03-28 op
14 ddc03123 2020-03-28 op (defn fmt [d]
15 ddc03123 2020-03-28 op (.format d pattern))
16 ddc03123 2020-03-28 op
17 ddc03123 2020-03-28 op (defn fmt-loc [d]
18 ddc03123 2020-03-28 op (.format d pattern-loc))
19 ddc03123 2020-03-28 op
20 4f9bd2e2 2020-03-30 op (defn fmt-rfc-2822 [d]
21 4f9bd2e2 2020-03-30 op (let [pattern (DateTimeFormatter/ofPattern "EEE, dd MMM yyyy")]
22 4f9bd2e2 2020-03-30 op (str (.format d pattern)
23 4f9bd2e2 2020-03-30 op " 00:00:00 GMT")))
24 4f9bd2e2 2020-03-30 op
25 441c3bcd 2020-11-19 op (defn fmt-iso8601 [d]
26 ce07a90d 2020-12-01 op (let [pattern (DateTimeFormatter/ofPattern "yyyy-MM-dd")]
27 441c3bcd 2020-11-19 op (.format d pattern)))
28 441c3bcd 2020-11-19 op
29 ddc03123 2020-03-28 op (defn parse [s]
30 ddc03123 2020-03-28 op (LocalDate/parse s pattern))
31 ddc03123 2020-03-28 op
32 ddc03123 2020-03-28 op (comment
33 ddc03123 2020-03-28 op (parse "2020/03/24")
34 ddc03123 2020-03-28 op (fmt (LocalDate/now))
35 ddc03123 2020-03-28 op (fmt-loc (LocalDate/now))
36 ddc03123 2020-03-28 op )