Android-System Time Acquisition Method
Method 1:
Import java. text. simpleDateFormat; SimpleDateFormat formatter = new SimpleDateFormat ("yyyy-MM-dd HH: mm: ss"); Date curDate = new Date (System. currentTimeMillis (); // obtain the current time
String str = formatter. format (curDate );
Method 2:
Obtain system time 1. Long time = System. currentTimeMillis (); 2. Final Calendar mCalendar = Calendar. getInstance (); mCalendar. setTimeInMillis (time); hour: mHour = mCalendar. get (Calendar. HOUR); minutes: mMinuts = mCalendar. get (Calendar. MINUTE); 3. Time t = new Time (); // or Time t = new Time ("GMT + 8"); plus Time Zone data t. setToNow (); // obtain the system Time. Int year = t. year; int month = t. month; int date = t. monthDay; int hour = t. hour; // 0-23 4. DateFormat df = new SimpleDateFormat ("HH: mm: ss"); df. format (new Date ());