final String dateString = "Jan 2, 2012";
final DateTimeFormatter dtf = new DateTimeFormatterBuilder().appendMonthOfYearShortText().appendLiteral(" ").appendDayOfMonth(1).appendLiteral(", ").appendYear(4, 4).toFormatter();
final DateTime jodaDate = dtf.parseDateTime(dateString);
System.out.println(jodaDate);
final Date javaDate = new Date(jodaDate.getMillis());
System.out.println(javaDate);
Output er
2012-01-02T00:00:00.000+02:00
Mon Jan 02 00:00:00 EET 2012
Næste for:
final String dateString = "Jan 1, 2012";
output er:
2012-01-01T00:00:00.000+02:00
Sun Jan 01 00:00:00 EET 2012