Calendar category, date and time devoted to the conversion between a specific time and calendar field.
Use Calendar to get the current date and time is very simple:
Calendar calendar = Calendar.getInstance (); // gets current instance of the calendar
with the date, we can very easily format the date into the format we need
Formatter new new = the SimpleDateFormat the SimpleDateFormat ( "dd-the MM-YYYY HH: mm: SS");
System.out.println (formatter.format (calendar.getTime ()));
result of the above code is printed as follows:
25-11-2018 00:43:39