Wrong format on String to Date conversion

Asked

Viewed 23 times

0

I have the following date in format String: 12-12-2017

I’m trying to pass this figure to java.util.Date. I’m trying like this:

SimpleDateFormat formatter = new SimpleDateFormat("dd-MM-yyyy");
            final String valor = cell.getStringCellValue();
            return formatter.parse(valor);

The problem is that my return is like this:

Tue Dec 12 00:00:00 BRST 2017

I want it to go back exactly as it is in String, someone knows how I can solve ?

  • This is the Date type format. There is no way to return the way you want in this type, unless it returns as a string.

  • Ahhh, seriously ? But I’ll get around because as this will be displayed on a screen(jsf), I use a convert.

  • 1

    Thank you @Articuno

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.