java.time.Duration.withNanos() 方法示例 java.time.Duration.toString() 方法示例 java.time.Duration.withSeconds() 方法示例 java.time.Duration.withNanos() 方法示例 package com.codingdict; import java.time.Duration; public class DurationDemo { public static void main(String[] args) { Duration duration = Duration.ofDays(2); System.out.println(duration.toString()); duration = duration.withNanos(2000); System.out.println(duration.toString()); } } java.time.Duration.toString() 方法示例 java.time.Duration.withSeconds() 方法示例