0

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
Ezekiel
  • 167
  • 3
  • 11
  • 1
    @Andre: it's not called, *"unparsing"*, anymore? :) – mike3996 Aug 25 '15 at 11:38
  • 1
    Sure, I already did this: (f/unparse (f/formatter "yyyy-MM-dd") (t/today)) but got an error that says: org.joda.time.LocalDate cannot be cast to org.joda.time.ReadableInstant – Ezekiel Aug 25 '15 at 12:22

1 Answers1

1

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"
birdspider
  • 3,034
  • 1
  • 16
  • 25