import java.time.Instant;
import java.time.ZoneId;/** 来 自 n o w j a v a . c o m**/
import java.time.ZonedDateTime;
import java.time.temporal.ChronoUnit;
public class Main {
public static void main(String[] args){
Instant timestamp = Instant.now();
System.out.println("The current timestamp: " + timestamp);
//Now minus three days
Instant minusThree = timestamp.minus(3, ChronoUnit.DAYS);
System.out.println("Now minus three days:" + minusThree);
ZonedDateTime atZone = timestamp.atZone(ZoneId.of("GMT"));
System.out.println(atZone);
/**
来 自
时 代 J a v a - N o w J a v a . c o m
**/
/**代码未完, 请加载全部代码(NowJava.com).**/
本文系作者在时代Java发表,未经许可,不得转载。如有侵权,请联系nowjava@qq.com删除。