Java Date Time Java Java API
java.time.Period
public Period minusDays(long daysToSubtract)
This method returns a copy of this period with the specified days subtracted.
package com.logicbig.example.period;import java.time.Period;public class MinusDaysExample { public static void main(String... args) { Period p = Period.of(100, 10, 20); System.out.println(p); Period p2 = p.minusDays(5); System.out.println(p2); Period p3 = p.minusDays(50000); System.out.println(p3); Period p4 = p.minusDays(-50000); System.out.println(p4); }}
P100Y10M20DP100Y10M15DP100Y10M-49980DP100Y10M50020D