We would like to know how to add one hour to Instant.
import java.time.Instant; import java.time.temporal.ChronoUnit; /*from ww w .j av a 2 s . c om*/ public class Main { public static void main(String[] args) { Instant timestamp = Instant.now(); System.out.println(timestamp); System.out.println(timestamp.plus(1, ChronoUnit.HOURS)); } }
The code above generates the following result.