LocalDate minusDays() method in Java with Examples Last Updated : 31 Oct, 2020 Comments Improve Suggest changes Like Article Like Report The minusDays() method of LocalDate class in Java is used to subtract the number of specified day from this LocalDate and return a copy of LocalDate.For example, 2019-01-01 minus one day would result in 2018-12-31. This instance is immutable and unaffected by this method call. Syntax: public LocalDate minusDays(long daysToSubtract) Parameters: This method accepts a single parameter daysToSubtract which represents the days to subtract, may be negative. Return value: This method returns a LocalDate based on this date with the days subtracted, not null. Exception: This method throws DateTimeException if the result exceeds the supported date range. Below programs illustrate the minusDays() method: Program 1: Java // Java program to demonstrate // LocalDate.minusDays() method import java.time.*; public class GFG { public static void main(String[] args) { // create a LocalDate object LocalDate date = LocalDate.parse("2018-11-13"); // print instance System.out.println("LocalDate before" + " subtracting days: " + date); // subtract 17 days LocalDate returnvalue = date.minusDays(17); // print result System.out.println("LocalDate after " + " subtracting days: " + returnvalue); } } Output: LocalDate before subtracting days: 2018-11-13 LocalDate after subtracting days: 2018-10-27 Program 2: Java // Java program to demonstrate // LocalDate.minusDays() method import java.time.*; public class GFG { public static void main(String[] args) { // create a LocalDate object LocalDate date = LocalDate.parse("2018-12-24"); // print instance System.out.println("LocalDate before" + " subtracting days: " + date); // subtract -15 days LocalDate returnvalue = date.minusDays(-15); // print result System.out.println("LocalDate after " + " subtracting days: " + returnvalue); } } Output: LocalDate before subtracting days: 2018-12-24 LocalDate after subtracting days: 2019-01-08 Reference: https://docs.oracle.com/javase/10/docs/api/java/time/LocalDate.html#minusDays(long) Comment More infoAdvertise with us Next Article LocalDate plusDays() Method in Java with Examples A AmanSingh2210 Follow Improve Article Tags : Java Java-Functions Java-time package Java-LocalDate Practice Tags : Java Similar Reads LocalDate minus() method in Java with Examples In LocalDate class, there are two types of minus() method depending upon the parameters passed to it. minus(long amountTosubtract, TemporalUnit unit) minus() method of a LocalDate class used to Returns a copy of this LocalDate with the specified amount of unit subtracted to LocalDate.If it is not po 2 min read LocalDate plusDays() Method in Java with Examples The plusDays() method of a LocalDate class in Java is used to add the number of specified day in this LocalDate and return a copy of LocalDate. For example, 2018-12-31 plus one day would result in 2019-01-01. This instance is immutable and unaffected by this method call. Syntax: public LocalDate plu 2 min read LocalDate minusYears() method in Java with Examples The minusYears() method of a LocalDate class is used to subtract the number of specified years from this LocalDate and return a copy of LocalDate. This method subtracts the years field in the following steps: Firstly, it subtracts the years from the year field in this LocalDate. Check if the date af 2 min read LocalDate minusWeeks() method in Java with Examples The minusWeeks() method of a LocalDate class in Java is used to subtract the number of specified week from this LocalDate and return a copy of LocalDate.For example, 2018-12-24 minus one week would result in 2018-12-17. This instance is immutable and unaffected by this method call. Syntax: public Lo 2 min read LocalDateTime minus() method in Java with Examples In LocalDateTime class, there are two types of minus() method depending upon the parameters passed to it. minus(long amountTosubtract, TemporalUnit unit) minus() method of a LocalDateTime class used to returns a copy of this LocalDateTime with the specified amount of unit subtracted.If it is not pos 3 min read LocalDate minusMonths() method in Java with Examples The minusMonths() method of LocalDate class in Java is used to subtract the number of specified months from this LocalDate and return a copy of LocalDate. This method subtracts the months field in the following steps: subtract the months from the month-of-year field. Check if the date after subtract 2 min read Like