Java Date Time Java Java API
java.time.Period
public Period multipliedBy(int scalar)
This method returns a new instance of Period with each element in this period multiplied by the specified scalar amount
package com.logicbig.example.period;import java.time.Period;public class MultipliedByExample { public static void main(String... args) { Period p = Period.of(100, 10, 20); System.out.println(p); Period p2 = p.multipliedBy(2); System.out.println(p2); Period p3 = p.multipliedBy(-10); System.out.println(p3); }}
P100Y10M20DP200Y20M40DP-1000Y-100M-200D