-2

As stated in the Title of the question , i have different days in different accounts, How to get the date part of these

Adham
  • 63,550
  • 98
  • 229
  • 344

1 Answers1

1

Just change the date formats below depending on your date format:

DateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
try {
    Date date = (Date)formatter.parse(str); 
    DateFormat df = new SimpleDateFormat("MM"); // you can use 'dd' for date
    return df.format(date);
} catch (ParseException e) {
    e.printStackTrace();
    return null;
}