从 Epoch 秒和毫秒创建 Instant 的 Java 程序
从 Epoch 秒创建 Instant
示例
import java.time.Instant;
public class Demo {
public static void main(String[] args) {
Instant instant = Instant.ofEpochSecond(282829279);
System.out.println(instant);
}
}输出
1978-12-18T11:41:19Z
从 Epoch 毫秒创建 Instant
示例
import java.time.Instant;
public class Demo {
public static void main(String[] args) {
Instant instant = Instant.ofEpochMilli(272827282728l);
System.out.println(instant);
}
}输出
1978-08-24T17:21:22.728Z
广告
数据结构
网络
RDBMS
操作系统
Java
iOS
HTML
CSS
Android
Python
C 编程
C++
C#
MongoDB
MySQL
Javascript
PHP