Reputation: 844
I am new to android deveolpment. I want to convert the String
"Mon, 11 Feb 2013 08:00:00 CST" to a Date
, and I also want to add this date to personal calendar.
Can anyone help me with this?
Upvotes: 0
Views: 171
Reputation: 3417
Date d= new SimpleDateFormat("Yourdateformathere").parse("yourstringhere");
Upvotes: 0
Reputation: 6738
Try this...
String time1 = "Mon, 11 Feb 2013 08:00:00 CST";
String str="";
Date date;
try {
date = new SimpleDateFormat("EEE, dd MMM yyyy hh:mm:ss z").parse(time1);
str = new SimpleDateFormat("YOUR REQUIRED FORMATE").format(date);
System.out.println("output DATE== "+str);
} catch (ParseException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
Upvotes: 0
Reputation: 4856
This question looks somewhat similar to: java string to datetime conversion issue
String d1String = "Mon, 11 Feb 2013 08:00:00 CST";
DateFormat df = new SimpleDateFormat("EEE, dd MMM yyyy hh:mm:ss z");
Date d1 = df.parse(d1String);
Upvotes: 1