一天的開始時間:我們將(當前輸入時間戳+時間戳的初始值)對一天取餘,然後剪掉餘數就是當天開始時間
public static Long startTime(Long now) {
Long startTime = now - (now + 8 * 3600) % 86400;
System.out.println(startTime);
return startTime;
}
結束的時間戳,我們就加上86400(一天的時間)
public static Long endTime(Long now){
return startTime(now)+86400;
}