更新时间:2023-09-20 23:39:34
您应使用SimpleDateFormat
(或 Joda Time ),而不是尝试自己解析:
You should use SimpleDateFormat
(or the equivalent from Joda Time) rather than trying to parse this yourself:
DateFormat format = new SimpleDateFormat("dd/MM/yyyy", Locale.US);
format.setTimeZone(TimeZone.getTimeZone("Etc/UTC"));
java.util.Date date = format.parse(text);
java.sql.Date sqlDate = new java.sql.Date(date.getTime());