-3

Hi, I have a string like:

String selectedDate = "Fri Jan 17 00:00:00 CAT 2014";

I need to format it to:

DD.MM.YYYY = 17.01.2014 00:00:00

Can anyone help please see code below:

String  date = getDate(selectedDate);

private String getDate(String inpuDate) {
    Date date = new SimpleDateFormat("yyyy-mm-dd hh:mm:ss ").parse(inputDate);
    return new SimpleDateFormat("dd.mm.yyyy hh:mm:ss").format(date);
}
ztirom
  • 4,382
  • 3
  • 28
  • 39
21stking
  • 1,191
  • 11
  • 19

1 Answers1

3

Try the following:

String  date = getDate(selectedDate);

private String getDate(String inpuDate) {
    Date date = new SimpleDateFormat("EEE MMM d hh:mm:ss z yyyy").parse(inputDate);
    return new SimpleDateFormat("dd.MM.yyyy hh:mm:ss").format(date);
}
stefana
  • 2,606
  • 3
  • 29
  • 47