SimpleDateFormat format1 = new SimpleDateFormat("yyyy-MM-dd");
SimpleDateFormat format2 = new SimpleDateFormat("dd-MM-yyyy");
Date date = format1.parse("2013-02-21");
System.out.println(format2.format(date));
More Related Contents:
- java.text.ParseException: Unparseable date: "Augu 16, 1979" [duplicate]
- Y returns 2012 while y returns 2011 in SimpleDateFormat
- Illegal pattern character ‘T’ when parsing a date string to java.util.Date
- Why is Java’s SimpleDateFormat not thread-safe? [duplicate]
- java.text.ParseException: Unparseable date
- SimpleDateFormat producing wrong date time when parsing “YYYY-MM-dd HH:mm”
- Java SimpleDateFormat always returning January for Month
- Parsing ISO 8601 date format like 2015-06-27T13:16:37.363Z in Java [duplicate]
- Parsing a date’s ordinal indicator ( st, nd, rd, th ) in a date-time string
- Changing String date format
- Java Date year calculation is off by year for two days
- Get yesterday’s date using Date [duplicate]
- How to parse month full form string using DateFormat in Java?
- SimpleDateFormat parse loses timezone [duplicate]
- SimpleDateFormat parse(string str) doesn’t throw an exception when str = 2011/12/12aaaaaaaaa?
- Java Convert GMT/UTC to Local time doesn’t work as expected
- How to convert date in to yyyy-MM-dd Format?
- Displaying AM and PM in lower case after date formatting
- String-Date conversion with nanoseconds
- How to convert HH:mm:ss.SSS to milliseconds?
- How to convert a string Date to long millseconds
- Why can’t this SimpleDateFormat parse this date string?
- SimpleDateFormat giving wrong date instead of error
- Java SimpleDateFormat Timezone offset with minute separated by colon
- Getting wrong month when using SimpleDateFormat.parse
- Simple Date format returns Wrong date intermittently [duplicate]
- Why is the month changed to 50 after I added 10 minutes?
- java.text.ParseException: Unparseable date: “01:19 PM”
- Parse a String to Date in Java
- Java SimpleDateFormat pattern for W3C XML dates with timezone [duplicate]