// 获取当天凌晨0点0分0秒Date Calendar calendar1 = Calendar.getInstance(); calendar1.set(calendar1.get(Calendar.YEAR), calendar1.get(Calendar.MONTH), calendar1.get(Calendar.DAY_OF_MONTH), 0, 0, 0); Date beginOfDate = calendar1.getTime(); System.out.println(beginOfDate);
也可以设置为任一时间
Calendar.HOUR_OF_DAY是24小时制
Calendar.HOUR是12小时制