上传数据是要求上传的时间类似于这种20101111T11:11:11中间多了一个字母T。试着直接在这里面写T
public class datetest {
public static void main(String[] args) {
Date date = new Date();
SimpleDateFormat s = new SimpleDateFormat("YYYY-MM-ddThh:mm:ss");
String ss =s.format(date);
System.err.println(ss);
}
}
结果直接报错,传递参数错误。看来对后面日期格式字符串有要求
Exception in thread "main" java.lang.IllegalArgumentException: Illegal pattern character 'T'
at java.text.SimpleDateFormat.compile(Unknown Source)
at java.text.SimpleDateFormat.initialize(Unknown Source)
at java.text.SimpleDateFormat.<init>(Unknown Source)
at java.text.SimpleDateFormat.<init>(Unknown Source)
at test.datetest.main(datetest.java:10)
网上查看确实是在那个位置拼写,不过得用单引号引上。如