從 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