//需要转换的时间
String time = "01:00:00";
SimpleDateFormat simpleDateFormat1 = new SimpleDateFormat("yyyy-MM-dd");
//先后去当天年月日
String format = simpleDateFormat1.format(Calendar.getInstance().getTime());
//年月日拼接时间,注意中间有个空格
format = format + " " + time;
SimpleDateFormat simpleDateFormat2 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
//转为Date
Date parseDate = simpleDateFormat2.parse(format);
Long parseTime = parseDate.getTime();
System.out.println(parseTime);
时间转为日期00:00:00 转为 当天的 yyyy-MM-dd HH:mm:ss或Date或时间戳
最新推荐文章于 2024-05-13 19:14:21 发布