Java Date Time - Period multipliedBy(int scalar) example








Period multipliedBy(int scalar) returns a new instance with each element in this period multiplied by the specified scalar.

Syntax

multipliedBy has the following syntax.

public Period multipliedBy(int scalar)

Example

The following example shows how to use multipliedBy.

import java.time.Period;
/*from w w  w . j av  a 2s  .c o m*/
public class Main {
  public static void main(String[] args) {
    Period p = Period.ofMonths(1);
    
    Period l = p.multipliedBy(10);
    System.out.println(l);

  }
}

The code above generates the following result.