从纪元创建即时
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
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