void getTime4 () {
Time t=new Time ();///the Time t=new Time (GMT + 8 "); Along with the Time Zone information,
T.s etToNow ();//get the system time,
String time=t.y Lin ear + "years" + (t.m onth + 1) + "month", t.m onthDay + ", "our +" h "+ +, Todd Harper t.m inute +" m "+ t.s econd;
The e (" MSG ", time);
}
Search on the Internet by many such access time and formatted, but how to prompt an error on my side,


CodePudding user response:
If just for the time why not use theSimpleDateFormat df=new SimpleDateFormat (" MM - dd yyyy - HH: MM: ss ");//set the date formatthis? Or must use the time to get time?
System. The out. Println (df) format (new Date ()));//new Date () to obtain the current system time
CodePudding user response:
Is not the Time in the same packageCodePudding user response: