Here's the code:
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ"); String strDate = ""; try { //dateInString is variable contain : 2019-08-25T13:45:13+00:00 Date date1 = formatter.parse(dateInString.replaceAll("Z$", "+0000")); DateFormat dateFormat = new SimpleDateFormat("dd-MMM-yy"); strDate = dateFormat.format(date1); //you got the new date format on string } catch (ParseException e) { e.printStackTrace(); }
Explanation about date format may be found at this link :
https://docs.oracle.com/javase/7/docs/api/java/text/SimpleDateFormat.html
Tidak ada komentar:
Posting Komentar