获取当前日期

基本类型 / 日期和时间

; Clojure 没有自己的日期类型,通过互操作使用 java.time
(import '[java.time LocalDate LocalDateTime ZonedDateTime ZoneId])

(def today (LocalDate/now))
(def now (LocalDateTime/now))
(def utc-now (ZonedDateTime/now (ZoneId/of "UTC")))
(def wake-now (ZonedDateTime/now (ZoneId/of "Pacific/Wake")))

; 每次运行的时刻都不同,所以只打印其形态,而不打印具体值
(println "today is a" (.getName (class today)))
(println "today as text is" (count (str today)) "chars, like 2026-08-16")
(println "utc-now zone is" (str (.getZone utc-now)))
(println "wake-now zone is" (str (.getZone wake-now)))
(println "now is past midnight:" (.isAfter now (.atStartOfDay today)))