Reputation: 10039
I am using the following piece of code to parse a date -
DateFormat dateFormatIn = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.S'Z'");
String ts = "2011-06-15T17:34:09.291Z";
String timestamp = dateFormatIn.format(ts);
It throws me an IllegalArgumentException. Any idea what is the right way to go about it?
Upvotes: 0
Views: 372
Reputation: 12312
DateFormat.format() expects a Date
as parameter and not a String
.
http://developer.android.com/reference/java/text/DateFormat.html#format(java.util.Date)
U need to use DateFormat.parse() to get the Date
Upvotes: 3