Search code examples
javaweblogicjodatime

How do I change the hour and minute on a joda time DateTime object?


I've tried the following two options:

        DateTime dt = new DateTime();
        dt = dt.plusDays(1).withMinuteOfHour(0);

and

        DateTime dt = new DateTime();
        dt = dt.withMinuteOfHour(0);

they both report the following error message:

Method "withMinuteOfHour" with signature "(I)Lorg/joda/time/DateTime;" is not applicable on this object

I'm using joda time 2.3:

joda-time:joda-time:2.3

Solution

  • Tracked this to a version conflict between the joda time version included with weblogic, and the one that my application wants to use.

    See the answer to this question for ideas for a workaround - solutions #2/#3 in the accepted answer are probably the correct ones to use (and worked for me in this situation).