如何将时间重置为 00:00:00 并更改为 timeMilis?

How to reset time to 00:00:00 and change to timeMilis?

我有问题: 长timeInMillis = 1488943098615; //-> 2017 年 3 月 8 日星期三 10:18:18

如何从 1488943098615 (wed mar 08 2017 10:18:18) -> ? (timeInMillis) (wed mar 08 2017 00:00:00)。这意味着要占用一天中的所有时间。消除小时和分钟。

Calendar cal = Calendar.getInstance(); // defaults to currentTimeInMs
//cal.setTimeInMillis(myCurrentTime); //if you have a timestamp already
cal.set(Calendar.HOUR_OF_DAY, 0); //reset just the hour and minute parts
cal.set(Calendar.MINUTE, 0);      //leaving the same date
long msAtMidnight = cal.getTimeInMillis();

你得到当前日期然后你 sub () 当前日期,小时 = 0,分钟 = 0,秒 = 0

Vitual code

Date currentDate = miliSecond (yyyyMMddHHmmss)
Date currentStartDate = miliSecond(yyyyMMdd000000)
miliSecondSub = currentDate - currentStartDate;
Date now = Date(miliSecondSub)