Questions tagged [clj-time]

23 questions
1
vote
1 answer

parse doesn't accept all month names abbreviation

For a given custom-formatter, parse refuses certain month values. (require '[clj-time.core :as t] '[clj-time.format :as f]) (let [custom-formatter (f/formatter "dd MMM yyyy")] (f/parse custom-formatter "27 mar 2010") (f/parse custom-formatter …
user3639782
  • 487
  • 3
  • 10
1
vote
2 answers

Clojure: serializing and parsing date/time to/from file?

I'd like to store some test data to a file and read it out again in my tests. The data is a sequence of Clojure maps, one property of which is a clj-time (org.joda.time.DateTime) date/time. When I write the value to the file (with spit), it…
Matthew Gertner
  • 4,487
  • 2
  • 32
  • 54
1
vote
2 answers

Time difference respecting day light savings

I have two longs representing time since the epoch. They both have the same timezone. I want to find the difference in seconds between these two times, respecting day light savings. (def a (java.util.Date. 1259568796000)) ;; Before Day Light…
Mike
  • 19,267
  • 11
  • 56
  • 72
1
vote
1 answer

clj-time always returns today's date.

I have a strange problem here. I am calling dates from a database and I am attempting to show the PostgreSQL dates, formatted as "2013-01-01", to display on my site as "January 1, 2013" I have the following code: (ns mr.layouts (:require …
dizzystar
  • 1,055
  • 12
  • 22
0
votes
1 answer

ICoerce produces protocol error for to-date-time

I took over a Clojure project and I am experiencing an error as follows: No implementation of method: :to-date-time of protocol: #'clj-time.coerce/ICoerce found for class: java.time.LocalDateTime Where I am trying to assign a value in here: {…
Julienknl
  • 11
  • 4
0
votes
1 answer

Clojure java.lang.NoClassDefFoundError when calling clj-time/last-day-of-the-month

I called (clj-time.core/last-day-of-the-month 1999 2) and (clj-time.core/number-of-days-in-the-month 1999 2) both throws java.lang.NoClassDefFoundError org/joda/time/DateTime$Property org.joda.time.DateTime.dayOfMonth (DateTime.java:1971) The…
cmal
  • 2,062
  • 1
  • 18
  • 35
0
votes
2 answers

Clojure clj-time : parse local string

I have trouble making the interop between java.util.Date and clj-time. I have first raw data which is an instance of java.util.Date, let's day : (def date (new java.util.util.Date)) I want to turn in into a clj-time object so I do : (def st-date…
Joseph Yourine
  • 1,301
  • 1
  • 8
  • 18
0
votes
1 answer

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) ;; [# 15] I need the date like this: ;; 2015-08-25
Ezekiel
  • 167
  • 3
  • 11
1
2