Created
November 27, 2014 11:51
-
-
Save devrath/e1c01fc01d0adfbb7858 to your computer and use it in GitHub Desktop.
Convert one date format to another
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| String startDateString = edtTxtDateId.getText().toString(); | |
| String newDateString = null; | |
| DateFormat df = new SimpleDateFormat("yyyy/mm/dd",Locale.ENGLISH); | |
| DateFormat sdf = new SimpleDateFormat("mm/dd/yyyy",Locale.ENGLISH); | |
| Date startDate; | |
| try { | |
| startDate = sdf.parse(startDateString); | |
| newDateString = df.format(startDate); | |
| System.out.println(newDateString); | |
| } catch (ParseException e) { | |
| e.printStackTrace(); | |
| } | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment