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'");
Strin开发者_如何转开发g 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?
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
精彩评论