Example #1
0
 public static int getCurrentDateInt() {
   Calendar cal = Calendar.getInstance();
   return Integer.valueOf(
       Common.checkDigit(cal.get(Calendar.YEAR))
           + Common.checkDigit(cal.get(Calendar.MONTH))
           + Common.checkDigit(cal.get(Calendar.DATE)));
 }
Example #2
0
 public static String getCurrentDate() {
   Calendar cal = Calendar.getInstance();
   return cal.get(Calendar.YEAR)
       + "/"
       + Common.checkDigit(cal.get(Calendar.MONTH))
       + "/"
       + Common.checkDigit(cal.get(Calendar.DAY_OF_MONTH));
 }
Example #3
0
 public static String getCurrentTime() {
   String currentTime = "PM";
   Calendar cal = Calendar.getInstance();
   if (cal.get(Calendar.AM_PM) == Calendar.AM) currentTime = "AM";
   return Common.checkDigit(cal.get(Calendar.HOUR))
       + ":"
       + Common.checkDigit(cal.get(Calendar.MINUTE))
       + " "
       + currentTime;
 }