Mega Code Archive

 
Categories / Android / Date Type
 

Get Current Time

import java.text.SimpleDateFormat; import java.util.Date;  class Utils {   public static String getCurrentTime() {     SimpleDateFormat formatter = new SimpleDateFormat("yyyy/MM/dd HH:mm");     Date curDate = new Date(System.currentTimeMillis());     return formatter.format(curDate);   }   public static String getCurrentTime2() {     SimpleDateFormat formatter = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");     Date curDate = new Date(System.currentTimeMillis());     return formatter.format(curDate);   } }