注意:要定义两个SimpleDateFormat 对象,一个不行
先将String类型的时间按照原来的格式转化成date类型,然后再调用format方法将时间格式变换成自己想要的格式
SimpleDateFormat dateFormat = new SimpleDateFormat("dd-MM-yyyy HH:mm"); SimpleDateFormat format = new SimpleDateFormat("yyyyMMddHHmm");
format.format(dateFormat.parse(realTimeDo.getStartAnalysis()))