can any help, how to get the right date from an String like this \"2014-01-10T09:41:16.000+0000\" my code is:
String strDate = \"2014-01-10T09:41:16.000+0000
The documentation states:
java.util.Calendar.MONTH
MONTH public static final int MONTH Field number for get and set indicating the month. This is a calendar-specific value. The first month of the year in the Gregorian and Julian calendars is JANUARY which is 0; the last depends on the number of months in a year.
-> Counting starts at 0 for Calendar.MONTH
I think the easiest would be to use another formatter object to do the formatting instead of building it yourself:
try {
Date d = new Date(cal.setTimeInMillis(formater.parse(strDate).getTime()));
SimpleDateFormat format = new SimpleDateFormat("dd-MM-yyyy");
String offerDate = format.format(d);
System.out.println(offerDate);
} catch (Exception e){
System.out.println(e.getMessage());
}