java.time.Duration.minus() 方法示例


java.time.Duration.minus() 方法示例

package com.codingdict;

import java.time.Duration;
import java.time.LocalTime;

public class DurationDemo {
   public static void main(String[] args) {

      Duration duration = Duration.between(LocalTime.NOON,LocalTime.MAX);  
      System.out.println(duration.getSeconds());
      Duration duration1 = Duration.between(LocalTime.MIN,LocalTime.NOON);  
      System.out.println(duration1.getSeconds());
      System.out.println(duration.minus(duration1).getSeconds());
   }
}