时间格式转换

来源:互联网 发布:卖域名 赚钱么 编辑:程序博客网 时间:2024/06/07 05:13

注意:要定义两个SimpleDateFormat 对象,一个不行先将String类型的时间按照原来的格式转化成date类型,然后再调用format方法将时间格式变换成自己想要的格式

SimpleDateFormat dateFormat = new SimpleDateFormat("dd-MM-yyyy HH:mm");SimpleDateFormat format = new SimpleDateFormat("yyyyMMddHHmm");
format.format(dateFormat.parse(realTimeDo.getStartAnalysis()))