使用SimpleDateFormat可以指定时间格式 String str = "20191008"; Date d=new SimpleDateFormat("yyyyMMdd").parse(str);
使用
SimpleDateFormat
可以指定时间格式