import java.time.Instant;
import java.time.OffsetDateTime;
import java.time.ZoneOffset;
/**
* Instant 类似为 java.util.Date
*/
public class Calendar002 {
public static void main(String[] args) {
// 默认时区 以本初子午线为准
Instant instant = Instant.now();
System.out.println(instant);
// 设置时区偏移量 (东八区)
OffsetDateTime instant1 = instant.atOffset(ZoneOffset.ofHours(8));
System.out.println(instant1);
// 获取时间戳 ------>Date.getTime()方法
long milli = instant.toEpochMilli();
System.out.println(milli);
// 通过毫秒数创建Instant实例对象 -----》Date(long milli)
Instant instant2 = Instant.ofEpochMilli(1585489660187L);
System.out.println(instant2);
}
}