fork(8) download
  1. import java.time.Instant;
  2. import java.time.temporal.ChronoUnit;
  3.  
  4. public class Main {
  5. public static void main(String[] args) {
  6. Instant instant1 = Instant.parse("2021-03-23T04:17:35Z");
  7. Instant instant2 = Instant.parse("2021-07-15T05:27:00Z");
  8.  
  9. System.out.println(instant1);
  10. System.out.println(instant2);
  11.  
  12. System.out.println(ChronoUnit.HOURS.between(instant1, instant2));
  13. }
  14. }
Success #stdin #stdout 0.13s 51396KB
stdin
Standard input is empty
stdout
2021-03-23T04:17:35Z
2021-07-15T05:27:00Z
2737