Convert date string from ISO 8601 format to another
问题 i have this piece of code , where i am trying to convert a date string from one format to another, and finally i want the date object again. String dateString = "2014-10-04"; SimpleDateFormat oldFormatter = new SimpleDateFormat("yyyy-MM-dd"); Date parsedDate = oldFormatter.parse(dateString); SimpleDateFormat newFormatter = new SimpleDateFormat("dd-MMM-yyyy"); String convertDateStr = newFormatter.format(parsedDate); Date convertedDate = newFormatter.parse(convertDateStr); when i was testing