?? gettime.java
字號:
package lgcsgwxt.means;
import java.util.Date;
import java.util.Calendar;
/**
* <p>Title: 魯廣超市進銷存系統(tǒng)</p>
*
* <p>Description: 北大青鳥魯廣校區(qū)S1畢業(yè)設計</p>
*
* <p>Copyright: Copyright (c) 2007</p>
*
* <p>Company: ST-117班</p>
*
* @author ST-117班第二小組
* @version 1.0
*/
public class GetTime {
public GetTime() {
}
public static String getTime() { //得到當前時間
Date date1 = new Date();
Calendar objcalendar;
String time = "";
objcalendar = Calendar.getInstance();
int year = objcalendar.get(Calendar.YEAR);
int Month = objcalendar.get(Calendar.MONTH);
Month += 1;
Integer Month1 = new Integer(Month);
String Monthtos;
if (Month < 10) {
Monthtos = "0" + Month1.toString();
} else {
Monthtos = Month1.toString();
}
int Date = objcalendar.get(Calendar.DATE);
Integer Date1 = new Integer(Date);
String Datetos;
if (Date < 10) {
Datetos = "0" + Date1.toString();
} else {
Datetos = Date1.toString();
}
String time1 = date1.toString().substring(11, 19);
time =year + "-" + Monthtos + "-" + Datetos + " " + time1;
return time;
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -