I want to find the current time and minutes and then convert String to int, so I can use them.
I write this code but Netbeans shows me always this error:
Exception in thread "main" java.lang.NumberFormatException: For input string: "mm "
at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)
at java.lang.Integer.parseInt(Integer.java:580)
at java.lang.Integer.parseInt(Integer.java:615)
t JavaApplication1.JavaApplication1.main(JavaApplication1.java:66)
C:\Users\eleft\AppData\Local\NetBeans\Cache\8.2\executor-snippets\run.xml:53:
Java returned: 1 BUILD FAILED (total time: 0 seconds)
//HOURS --12 hour form
Date date1 = new Date();
String strDateFormat1 = "hh ";
DateFormat dateFormat1 = new SimpleDateFormat(strDateFormat1);
String formattedDate1= dateFormat1.format(date1);
System.out.println("Current time of the day using Date - 12 hour format: " + formattedDate1);
//MINUTES
Date date2 = new Date();
String strDateFormat2 = "mm ";
DateFormat dateFormat2 = new SimpleDateFormat(strDateFormat2);
String formattedDate2= dateFormat2.format(date);
System.out.println("Current time of the day using Date - 12 hour format: " + formattedDate2+ "MINUTES");
int current_minutes=Integer.parseInt(strDateFormat2);
int current_hours=Integer.parseInt(strDateFormat1);