fork download
  1. /* package whatever; // don't place package name! */
  2.  
  3. import java.util.*;
  4. import java.lang.*;
  5. import java.io.*;
  6. import java.time.*;
  7.  
  8. /* Name of the class has to be "Main" only if the class is public. */
  9. class Ideone
  10. {
  11. public static void main (String[] args) throws java.lang.Exception
  12. {
  13. // your code goes here
  14. Instant ins = Instant.parse("2024-01-24T18:29:33.658729Z");
  15.  
  16. Instant ins2 = Instant.parse("2024-01-24T18:29:33.993196Z");
  17.  
  18. long seconds = ins.getEpochSecond() - ins2.getEpochSecond();
  19.  
  20. System.out.println(ins.toString());
  21. System.out.println(ins.getNano());
  22. System.out.println(seconds);
  23. }
  24. }
Success #stdin #stdout 0.09s 56752KB
stdin
Standard input is empty
stdout
2024-01-24T18:29:33.658729Z
658729000
0