BestJewSinceJC
Posting Maven
2,772 posts since Sep 2008
Reputation Points: 874
Solved Threads: 354
SimpleDateFormat class is needed
......
String yourdate="12-Aug-2009";
String currformat="dd-MMM-yyyy";
SimpleDateFormat fd=new SimpleDateFormat(currformat);
Date d1=fd.parse(yourdate);
System.out.println(d1);
String newformat="dd-MM-yyyy";
fd.applyPattern(newformat);
StringBuffer b=new StringBuffer();
System.out.println(fd.format(d1,b,new FieldPosition(0)));
....
__avd
Posting Genius (adatapost)
8,647 posts since Oct 2008
Reputation Points: 2,136
Solved Threads: 1,241
SimpleDateFormat class is needed
......
String yourdate="12-Aug-2009";
String currformat="dd-MMM-yyyy";
SimpleDateFormat fd=new SimpleDateFormat(currformat);
Date d1=fd.parse(yourdate);
System.out.println(d1);
String newformat="dd-MM-yyyy";
fd.applyPattern(newformat);
StringBuffer b=new StringBuffer();
System.out.println(fd.format(d1,b,new FieldPosition(0)));
....
You could have printed this:
//fd.format(d1)
System.out.println( fd.format(d1) );
javaAddict
Nearly a Senior Poster
3,329 posts since Dec 2007
Reputation Points: 1,014
Solved Threads: 448