Java examples for java.time:Quarter
get Last Date Of Last Quarter
import java.time.*; import java.time.temporal.IsoFields; import java.time.temporal.Temporal; import java.time.temporal.TemporalAdjuster; import java.time.temporal.TemporalAdjusters; import java.util.Date; public class Main{ public static Date getLastDateOfLastQuarter() { return toDate(LocalDate.now().with( new LastDateOfQuarterAdjuster(true))); }/*from w w w. j av a 2s .c o m*/ public static Date toDate(LocalDate date) { Instant instant = date.atStartOfDay() .atZone(ZoneId.systemDefault()).toInstant(); return Date.from(instant); } public static Date toDate(LocalDateTime date) { Instant instant = date.atZone(ZoneId.systemDefault()).toInstant(); return Date.from(instant); } }