Java examples for java.time:Day
minus Days from java.util.Date via LocalDate
//package com.java2s; import java.time.LocalDate; import java.time.ZoneId; import java.util.Date; public class Main { public static Date minusDays(Date date, int days) { return localDateToDate(dateToLocalDate(date).minusDays(days)); }/*from w w w . j ava2 s .com*/ public static Date localDateToDate(LocalDate localDate) { return Date.from(localDate.atStartOfDay(ZoneId.systemDefault()) .toInstant()); } public static LocalDate dateToLocalDate(Date date) { return date.toInstant().atZone(ZoneId.systemDefault()) .toLocalDate(); } }