dateclojureclj-time

Clojure current system date


How do I convert the result I got from clj-time into a real date.

require [clj-time.core :as t]

(t/today)    
;; [#<LocalDate 2015-08-25> 15]

I need the date like this:

;; 2015-08-25

Solution

  • joda time, therefore clj-time somehow distinguish between "regular" date-time and local-date-time; since (t/today) is a org.joda.time.LocalDate try unparse-local:

    user=> (f/unparse-local (f/formatter "Y-MM-dd") (t/today))
    "2015-08-25"