Date c = s.getCreateTime();
// SimpleDateFormat指定格式化模式
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
try {
先转换为String类型
String format1 = simpleDateFormat.format(c);
再转换为Long类型
Long ac = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse(format1).getTime();
s.setStartTime(ac);
}
catch (Exception x){
x.printStackTrace();
}
Date类型转换为Long类型实现
最新推荐文章于 2024-08-03 17:05:14 发布