Java中的LocalTime ofSecondOfDay()方法
可以使用ofSecondOfDay()Java中LocalTime类中的方法使用一天中的几秒钟来获取LocalTime对象。此方法需要一个参数,即一天中的秒,它返回一天中的秒的LocalTime对象。
演示此程序如下
示例
import java.time.*;
public class Demo {
public static void main(String[] args) {
long seconds = 18930;
System.out.println("The seconds of the day: " + seconds);
System.out.println("The LocalTime is: " + LocalTime.ofSecondOfDay(seconds));
}
}输出
The seconds of the day: 18930 The LocalTime is: 05:15:30
现在让我们了解上面的程序。
首先显示一天中的秒。然后使用该ofSecondOfDay()方法使用一天中的秒数获取LocalTime对象并进行打印。演示此的代码片段如下:
long seconds = 18930;
System.out.println("The seconds of the day: " + seconds);
System.out.println("The LocalTime is: " + LocalTime.ofSecondOfDay(seconds));热门推荐
1 带狗狗训练
4 听力训练狗狗
6 怎训练狗狗
7 腹肌训练狗狗
8 网球训练狗狗
9 记叙文训练狗狗
10 狗狗太凶怎么训练
11 核心力量训练狗狗
12 狗狗乱叫怎么训练
13 发音训练狗狗
14 怎么训练狗狗叼东西给主人
15 荆州训练狗狗
16 篮球训练狗狗
17 做训练狗狗
18 训练狗狗坐姿