Blob
1 (ns blog.time2 (:import (java.time.format DateTimeFormatter FormatStyle)3 (java.time LocalDate)4 (java.util Locale Date)))6 (def pattern7 (DateTimeFormatter/ofPattern "yyyy/MM/dd"))9 (def loc (Locale/forLanguageTag "en"))11 (def pattern-loc12 (DateTimeFormatter/ofPattern "dd MMMM yyy" loc))14 (defn fmt [d]15 (.format d pattern))17 (defn fmt-loc [d]18 (.format d pattern-loc))20 (defn fmt-rfc-2822 [d]21 (let [pattern (DateTimeFormatter/ofPattern "EEE, dd MMM yyyy")]22 (str (.format d pattern)23 " 00:00:00 GMT")))25 (defn fmt-iso8601 [d]26 (let [pattern (DateTimeFormatter/ofPattern "yyyy-MM-dd")]27 (.format d pattern)))29 (defn parse [s]30 (LocalDate/parse s pattern))32 (comment33 (parse "2020/03/24")34 (fmt (LocalDate/now))35 (fmt-loc (LocalDate/now))36 )