Your problem isn't in conversion form JDK Date to Joda DateTime at all. It's in parsing a string to a JDK Date.
Date d2=new Date("2014-12-12");
is a deprecated constructor call. You probably should either use a DateFormat to parse your datestring into a Date
, or parse it straight to Joda's DateTime
using its parse method and a similar DateTimeFormatter.
These parsing methods allow you to specify the format you're expecting explicitly rather than depending on the default Date.parse()
, which tries to figure out the format from the data. Specifically why it's failing in this instance I can't say, but this is code you just shouldn't be using anyway. It's been deprecated for years.