我打了电话
(clj-time.core/last-day-of-the-month 1999 2)
和
(clj-time.core/number-of-days-in-the-month 1999 2)
两次投掷
java.lang.NoClassDefFoundError org/joda/time/DateTime$Property org.joda.time.DateTime.dayOfMonth (DateTime.java:1971)
文档说:
(defn last-day-of-the-month
([^long year ^long month]
(last-day-of-the-month- (date-time year month)))
([dt]
(last-day-of-the-month- dt)))
(defn number-of-days-in-the-month
(^long [^DateTime dt]
(day (last-day-of-the-month- dt)))
(^long [^long year ^long month]
(day (last-day-of-the-month- (date-time year month)))))
我做错了什么?
谢谢!
以下是我的项目设置和依赖项:
(defproject xxx "0.1.2-SNAPSHOT"
:description ""
:dependencies [[org.clojure/clojure "1.8.0"]
...
[clj-time "0.11.0"]
...)
我在项目 repl 中试过这个:
clj-time=> clj-time.core/last-day-of-the-month
#object[clj_time.core$last_day_of_the_month 0x6a86b560 "clj_time.core$last_day_of_the_month@6a86b560"]
以上结果来自我通过 ssh 通过通道连接到的 repl 服务器。
当我lein repl
在本地项目文件夹中运行时,可以得到正确的结果:
xxx.core=> (clj-time.core/last-day-of-the-month 2016 2)
#object[org.joda.time.DateTime 0x22a0534e "2016-02-29T00:00:00.000Z"]
xxx.core=> (clj-time.core/number-of-days-in-the-month 2016 2)
29
我是 Clojure 的新手。这些信息有用吗?
重启repl后,现在问题解决了。