public static void main(String[] args) {
Calendar todayStart = Calendar.getInstance();
todayStart.set(Calendar.HOUR_OF_DAY, 0);
todayStart.set(Calendar.MINUTE, 0);
todayStart.set(Calendar.SECOND, 0);
todayStart.set(Calendar.MILLISECOND, 0);
System.out.println(todayStart.getTime().getTime());
Calendar todayEnd = Calendar.getInstance();
todayEnd.set(Calendar.HOUR_OF_DAY, 23);
todayEnd.set(Calendar.MINUTE, 59);
todayEnd.set(Calendar.SECOND, 59);
todayEnd.set(Calendar.MILLISECOND, 999);
System.out.println(todayEnd.getTime().getTime());
Calendar currentMinuteStart = Calendar.getInstance();
// currentMinuteStart.set(Calendar.HOUR_OF_DAY, 0);
// currentMinuteStart.set(Calendar.MINUTE, 0);
currentMinuteStart.set(Calendar.SECOND, 0);
currentMinuteStart.set(Calendar.MILLISECOND, 0);
System.out.println(currentMinuteStart.getTime().getTime());
Calendar currentMinuteEnd = Calendar.getInstance();
// currentMinuteEnd.set(Calendar.HOUR_OF_DAY, 23);
// currentMinuteEnd.set(Calendar.MINUTE, 59);
currentMinuteEnd.set(Calendar.SECOND, 59);
currentMinuteEnd.set(Calendar.MILLISECOND, 999);
System.out.println(currentMinuteEnd.getTime().getTime());
System.out.println(Long.parseLong(currentMinuteStart.getTime().getTime()/1000 + ""));
System.out.println(Long.parseLong(currentMinuteEnd.getTime().getTime()/1000 + ""));
}
java获取当天0点到24点的时间戳,获得当前分钟开始结束时间戳
最新推荐文章于 2024-07-14 03:07:35 发布