Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I have the String 11/08/2013 08:48:10

and i use SimpleDateFormat("MM/dd/yyyy HH:mm:ss")

and when im parsing it throws an exception : unparseable date

what's wrong with it ?

            String result = han.ExecuteUrl("http://"+han.IP+":8015/api/Values/GetLastChange"); 
            Log.d("Dal","result date time "+result); #result is 11/08/2013 08:48:10
            SimpleDateFormat dateFormat = new SimpleDateFormat("MM/dd/yyyy HH:mm:ss");

            Date convertedDate = new Date();
            try
            {

                convertedDate = dateFormat.parse(result);
            }
            catch (ParseException e)
            {
                e.printStackTrace();
            }
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
223 views
Welcome To Ask or Share your Answers For Others

1 Answer

Its working try parse your date like this..

String dtStart = "11/08/2013 08:48:10";
SimpleDateFormat format = new SimpleDateFormat("MM/dd/yyyy HH:mm:ss");
try {
    date = format.parse(dtStart);
    System.out.println("Date ->" + date);
} catch (ParseException e) {
    e.printStackTrace();
}

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...