java.time.Duration.between() 方法示例 java.time.Duration.addTo() 方法示例 java.time.Duration.compareTo() 方法示例 java.time.Duration.between() 方法示例 package com.codingdict; import java.time.Duration; import java.time.LocalDateTime; import java.time.LocalTime; public class DurationDemo { public static void main(String[] args) { Duration duration = Duration.between(LocalTime.NOON,LocalTime.MAX); LocalDateTime date = LocalDateTime.now(); System.out.println(date); date = (LocalDateTime)duration.addTo(date); System.out.println(date); } } java.time.Duration.addTo() 方法示例 java.time.Duration.compareTo() 方法示例