类型值plusHours不是org.joda.time.DateTime的成员 [英] Type value plusHours is not a member of org.joda.time.DateTime

查看:97
本文介绍了类型值plusHours不是org.joda.time.DateTime的成员的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Scala和Joda时间,但是我不能使用大多数方法.

I'm using Scala and Joda time, but I can't use most methods.

例如,这很好用

var now = DateTime.now()

但这不是

var now = DateTime.now()
var then = now.plusHours(2)

类型值plusHours不是org.joda.time.DateTime的成员

如果我建造,我还会收到以下错误:

If i build i receive also these errors:

加载DateTime时出错,缺少依赖项'org.joda.convert.FromString类',C:\ Documents and Settings \ Vallo \ Mis documentos \ Downloads \ joda-time-2.2.jar(org/joda/time /DateTime.class)TP4未知Scala问题

error while loading DateTime, Missing dependency 'class org.joda.convert.FromString', required by C:\Documents and Settings\Vallo\Mis documentos\Downloads\joda-time-2.2.jar(org/joda/time/DateTime.class) TP4 Unknown Scala Problem

加载DateTimeZone时出错,缺少依赖项'org.joda.convert.FromString类',C:\ Documents and Settings \ Vallo \ Mis documentos \ Downloads \ joda-time-2.2.jar(org/joda/time /DateTimeZone.class)TP4未知Scala问题

error while loading DateTimeZone, Missing dependency 'class org.joda.convert.FromString', required by C:\Documents and Settings\Vallo\Mis documentos\Downloads\joda-time-2.2.jar(org/joda/time/DateTimeZone.class) TP4 Unknown Scala Problem

错误,缺少依赖项类org.joda.convert.ToString",C:\ Documents and Settings \ Vallo \ Mis documentos \ Downloads \ joda-time-2.2.jar(org/joda/time /base/AbstractInstant.class)TP4未知Scala问题

error while loading AbstractInstant, Missing dependency 'class org.joda.convert.ToString', required by C:\Documents and Settings\Vallo\Mis documentos\Downloads\joda-time-2.2.jar(org/joda/time/base/AbstractInstant.class) TP4 Unknown Scala Problem

(文件C:\ Documents and Settings \ Vallo \ Mis documentos \ Downloads \ joda-time-2.2.jar存在)

(the file C:\Documents and Settings\Vallo\Mis documentos\Downloads\joda-time-2.2.jar exists)

但是,诸如DateTime.isBefore或.isAfter之类的方法可以正常工作.我感觉到静态方法是唯一对我有用的方法,但是我不确定.

However, methods like DateTime.isBefore or .isAfter works fine. I've got the feeling that static methods are the only one that work for me, but I'm not sure.

有任何线索吗?非常感谢.

Any clues? Thanks a lot.

推荐答案

似乎您可能需要添加

It seems that you might need to add joda-convert as a dependency too.

这篇关于类型值plusHours不是org.joda.time.DateTime的成员的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆