When I use this code:
Date data = new Date();
SimpleDateFormat formatador = new SimpleDateFormat("dd/MM/yyyy");
int dataAtual = Integer.parseInt(formatador.format(data));
System.out.println(dataAtual);
This error appears:
Exception in thread "main" java.lang.NumberFormatException: For input string: "15/09/2017" at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65) at java.lang.Integer.parseInt(Integer.java:580) at java.lang.Integer.parseInt(Integer.java:615)
I think it's because in Date format there are bars and they are not directly converted to integer, but I do not know how to do this conversion.