SimpleDateFormat “Unparseable date” Exception

后端 未结 8 1730
再見小時候
再見小時候 2020-12-20 16:55

I am trying to parse datetime string with SimpleDateFormat.parse() but I keep receiving Unparseable date exceptions.

Here is the date format I am trying

相关标签:
8条回答
  • 2020-12-20 17:57

    I believe that SimpleDateFormat will not parse timezones with a colon in them (-08:00). It should be able to parse the date 2011-10-06T12:00:00-0800.

    Some simple string manipulation should help you get rid of the colon.

    0 讨论(0)
  • 2020-12-20 17:59

    Try with

    SimpleDateFormat dateParser = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssz");
    
    0 讨论(0)
提交回复
热议问题