java.text.ParseException: Unparseable date: "2023-03-31T15:38"
时间: 2024-05-14 17:14:52 浏览: 191
This error occurs because the date format "2023-03-31T15:38" cannot be parsed by the default date parser in Java. To parse this date, you need to create a SimpleDateFormat object with the correct date format pattern and use it to parse the date string.
Here's an example:
```
String dateString = "2023-03-31T15:38";
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm");
Date date = dateFormat.parse(dateString);
```
In the above code, we create a SimpleDateFormat object with the pattern "yyyy-MM-dd'T'HH:mm", which corresponds to the format of the date string. We then use this object to parse the date string and get a Date object.
Note that the format pattern includes the 'T' character, which is used to separate the date and time portions of the string. If your date string uses a different separator character (such as a space), you'll need to adjust the format pattern accordingly.
阅读全文