View Single Post
  (#1 (permalink)) Old
sahuabinash sahuabinash is offline
Member
 
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Join Date: Apr 2008
Default String to formatted date - 04-22-2008, 12:02 PM

SimpleDateFormat df = new SimpleDateFormat("EEE MMM d HH:mm:ss zzz yyyy");
SimpleDateFormat df1 = new SimpleDateFormat("dd MMM yyyy");
Date d1 =null;
String formattedDate=null;
try {
d1=df.parse("Tue Apr 22 21:03:48 IST 2008");
formattedDate =df1.format(d1);

} catch (ParseException e) {

e.printStackTrace();
}
System.out.println(formattedDate);
Reply With Quote