public class DateFormatClass {
public static void main(String[] args) {
String mytime="Jan 17, 2012";
SimpleDateFormat dateFormat = new SimpleDateFormat(
"MMM dd, yyyy");
Date myDate = null;
try {
myDate = dateFormat.parse(mytime);
} catch (ParseException e) {
e.printStackTrace();
}
SimpleDateFormat timeFormat = new SimpleDateFormat("yyyy-MM-dd");
String finalDate = timeFormat.format(myDate);
System.out.println(finalDate);
}
}
Sunday, 15 September 2013
android string to date or date to string format
Subscribe to:
Post Comments
(
Atom
)
No comments :
Post a Comment