Type value plusHours is not a member of org.joda.time.DateTime

点点圈 提交于 2019-12-11 09:44:28

问题


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

For example this works fine

var now = DateTime.now()

But this doesn't

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

Type value plusHours is not a member of org.joda.time.DateTime

If i build i receive also these errors:

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

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

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

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

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.


回答1:


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



来源:https://stackoverflow.com/questions/17996921/type-value-plushours-is-not-a-member-of-org-joda-time-datetime

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!