fork(2) download
  1. import java.io.*;
  2. import java.util.*;
  3. import java.text.*;
  4.  
  5.  
  6.  
  7. public class Main {
  8. public static void main(String[] args) {
  9. Scanner in=new Scanner(new InputStreamReader(System.in));
  10. String d1 = in.nextLine();
  11. String d2 = in.nextLine();
  12. SimpleDateFormat format = new SimpleDateFormat("yyyy:MM:dd");
  13. Date date1 = null;
  14. Date date2 = null;
  15. try {
  16. date1 = format.parse(d2);
  17. date2 = format.parse(d1);
  18. } catch (Exception e) {
  19. e.printStackTrace();
  20. }
  21. long difference = date1.getTime() - date2.getTime();
  22. long days = difference / (24 * 60 * 60 * 1000);
  23. out.println(Math.abs(days));
  24.  
  25. in.close();
  26. out.close();
  27. }
  28.  
  29. }
Runtime error #stdin #stdout #stderr 0.1s 380672KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
Exception in thread "main" java.util.NoSuchElementException: No line found
	at java.util.Scanner.nextLine(Scanner.java:1585)
	at Main.main(Main.java:11)