java.time.Duration.ofMillis() 方法示例 java.time.Duration.ofHours() 方法示例 java.time.Duration.ofMinutes() 方法示例 java.time.Duration.ofMillis() 方法示例 package com.codingdict; import java.time.Duration; public class DurationDemo { public static void main(String[] args) { Duration duration = Duration.ofMillis(2000); System.out.println(duration.getSeconds()); } } java.time.Duration.ofHours() 方法示例 java.time.Duration.ofMinutes() 方法示例