javaandroiddateparsingsimpledateformat

Simple date format. Date parsing


I try to parse date like: Tue, 08 Sep 2015 12:32:55 +0300 and appy next pattern:SimpleDateFormat inputFormat = new SimpleDateFormat("EEE, d MMM yyyy hh:mm:ss zzzz"); But I catch exception java.text.ParseException: Unparseable date: "Sun, 13 Sep 2015 17:25:26 +0300" (at offset 0)


Solution

  • Try changing the code to

    SimpleDateFormat inputFormat = new SimpleDateFormat("EEE, d MMM yyyy HH:mm:ss zzzz", Locale.US);
    

    Edit:

    Additional amendment I have changed hh in your code to HH for 24 hours format