1

I am trying call org.joda.time.format.DateTimeFormatter#forPattern method.

But following seems not working.

scala> import org.joda.time.format.DateTimeFormatter
import org.joda.time.format.DateTimeFormatter

scala> DateTimeFormatter.forPattern("yyyyMMdd")
<console>:30: error: value forPattern is not a member of object org.joda.time.format.DateTimeFormatter
       DateTimeFormatter.forPattern("yyyyMMdd")
                         ^

Any pointer would be appreciated.

1 Answer 1

3

Java - Scala interoperability works as expected in such scenarios. You just messed up the class names probably. There is no DateTimeFormatter#forPattern according to this but there is DateTimeFormat#forPattern.

DateTimeFormat.forPattern("yyyyMMdd")

works like a charm.

Sign up to request clarification or add additional context in comments.

1 Comment

@battaio Thanks a lot.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.