import java.time.LocalDate; import java.time.LocalDateTime; import java.time.LocalTime;
public class Main { public static void main(String[] args) { // 获取当前日期 LocalDate currentDate = LocalDate.now();
// 设置时分秒为零点零分零秒
LocalTime zeroTime = LocalTime.of(0, 0, 0);
// 将当前日期和零时分秒组合得到当前时间戳
LocalDateTime currentDateTime = LocalDateTime.of(currentDate, zeroTime);
long timestamp = currentDateTime.toInstant(java.time.ZoneOffset.ofTotalSeconds(0)).toEpochMilli();
System.out.println("当前时间戳:" + timestamp);
}
}