且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

解析字符串用空格日期,导致ParseException的

更新时间:2023-02-26 11:03:05

您需要的日期格式调整到给定的字符串:

You need to adjust the date format to the given string:

EEE MMM dd HH:mm:ss Z yyyy

请确保使用正确的占位符,区分大小写等看看到的日期和时间模式的。

Make sure use the correct placeholders, case sensitive, etc. Take a look to the Date and Time Patterns.

对不起,我曾与Z模式的错误,'Z'是:

Sorry, I had a mistake with the 'z' pattern, 'Z' is:

SimpleDateFormat sdf = new SimpleDateFormat("EEE MMM dd HH:mm:ss Z yyyy", Locale.US);

看一看到 Locale.US ,以适用,因为个月和日是英语是很重要的。

Take a look to Locale.US, it is important to apply because the months and and days are in english.