You can use SimpleDateFormat
. Here's an example:
SimpleDateFormat formatter = new SimpleDateFormat("EEEE, MMM dd, yyyy HH:mm:ss a");
try {
Date date = formatter.parse("Friday, Jun 7, 2013 12:10:56 PM");
Log.wtf("TAG", new SimpleDateFormat("dd-MM-yyyy").format(date));
} catch (ParseException e) {
e.printStackTrace();
}
To adapt to your case, simply subscribe "Friday, Jun 7, 2013 12:10:56 PM"
to contato.getDatasEspeciais().toString()
, however you need to check exactly what format of your date is not fully visible. Here are some examples below that I found in this answer :
"yyyy.MM.dd G 'at' HH:mm:ss z" 2001.07.04 AD at 12:08:56 PDT
"EEE, MMM d, ''yy" Wed, Jul 4, '01
"h:mm a" 12:08 PM
"hh 'o''clock' a, zzzz" 12 o'clock PM, Pacific Daylight Time
"K:mm a, z" 0:08 PM, PDT
"yyyyy.MMMMM.dd GGG hh:mm aaa" 02001.July.04 AD 12:08 PM
"EEE, d MMM yyyy HH:mm:ss Z" Wed, 4 Jul 2001 12:08:56 -0700
"yyMMddHHmmssZ" 010704120856-0700
"yyyy-MM-dd'T'HH:mm:ss.SSS'Z'" 2001-07-04T12:08:56.235-0700
"yyyy-MM-dd'T'HH:mm:ss.SSSXXX" 2001-07-04T12:08:56.235-07:00
"YYYY-'W'ww-u" 2001-W27-3