这篇文章上次修改于 1998 天前,可能其部分内容已经发生变化,如有疑问可询问作者。 >groovy 日期计算报错报错:groovy.lang.MissingMethodException: No signature of method: java.util.Date.minus() is applicable for argument types: (Integer) values: [1] [1]groovy 日期计算: ```groovy def today = new Date() def d1 = today - 1 println(d1.format('yyyy-HH-mm')) ``` [2] 报错如下: ``` bash groovy.lang.MissingMethodException: No signature of method: java.util.Date.minus() is applicable for argument types: (Integer) values: [1] Possible solutions: find(), find(groovy.lang.Closure), is(java.lang.Object), any(), use([Ljava.lang.Object;), print(java.lang.Object) at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.unwrap(ScriptBytecodeAdapter.java:70) at org.codehaus.groovy.runtime.callsite.PojoMetaClassSite.call(PojoMetaClassSite.java:46) at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:47) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:115) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:127) at tv.rr.cashrank.CashRankApplication.main(CashRankApplication.groovy:100) ``` [3] 解决办法,加入依赖: ```xml org.codehaus.groovy groovy-dateutil 2.5.6 ```
没有评论