Beispiel #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;
 }
Beispiel #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;
 }