Exemple #1
0
 public static String getCurrentDate() {
   LocalDateTime now = LocalDateTime.now();
   int year = now.getYear();
   int month = now.getMonthOfYear();
   int day = now.getDayOfMonth();
   String date = day + "/" + month + "/" + year;
   return date;
 }
Exemple #2
0
 public static String getCurrentTime() {
   LocalDateTime now = LocalDateTime.now();
   int hour = now.getHourOfDay();
   int minute = now.getMinuteOfHour();
   int second = now.getSecondOfMinute();
   String time = hour + ":" + minute + ":" + second;
   return time;
 }