Android parse String to Date - unknown pattern character 'X'

前端 未结 13 1228
耶瑟儿~
耶瑟儿~ 2021-01-31 07:32

I have Service fetch date string from web and then I want to pare it to Date object. But somehow application crashes. This is my string that I\'m parsi

13条回答
  •  灰色年华
    2021-01-31 08:08

    The Android version of SimpleDateFormat doesn't support the X pattern so XXX won't work but instead you can use ZZZZZ which does the same and outputs the timezone in format +02:00 (or -02:00 depending on the local timezone).

提交回复
热议问题