java.time.OffsetTime.until() 方法示例


java.time.OffsetTime.until() 方法示例

package com.codingdict;

import java.time.OffsetTime;
import java.time.temporal.ChronoUnit;

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

      OffsetTime time = OffsetTime.parse("10:15:30+01:00");
      OffsetTime time1 = OffsetTime.now();
      System.out.println(time.until(time1, ChronoUnit.HOURS));  
   }
}