String date = "2013-07-18 16:57:22.0";
DateFormat format = new SimpleDateFormat("yyyy-MM-dd HH24:mm:SSSS.FF6");
Date dateTime=format.parse(date);
Calendar calendar = Calendar.getInstance(format.getTimeZone());
calendar.setTime(dateTime);
,我得到错误我收到错误500:java.text.ParseException:无法解析的日期: “2013年7月18日16:57:22.0”
错误500:java.text.ParseException :无法解析的日期: “2013年7月18日16:57:22.0”
我很高兴我得到所有这些upvotes,但为什么我得到比@davioooh谁提供了一个实际的工作答案? :) –
您好尼古拉斯knw我明白了我这些变化和新西兰它是在工作良好DateFormat格式=新SimpleDateFormat(“YYYY-MM-DD HH:MM:SS”); 日期dateTime = format.parse(date); Calendar calendar = Calendar.getInstance(format.getTimeZone()); calendar.setTime(dateTime); \t \t \t \t DateFormat dff = new SimpleDateFormat(“dd/MM/yyyy hh:mm:ss a”); \t \t \t \t dff.format(calendar.getTime()); –
我觉得这里可能有某种沟通不畅...... –