?? datetimeutils.java
字號:
package utils;
import java.text.SimpleDateFormat;
import java.util.Date;
/**
* @author lixiaoqing
*
*/
public class DatetimeUtils {
public static String getDateTime() {
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
Date Now = new Date();
String NDate = formatter.format(Now);
return NDate;
}
public static String getDate(){
return getDateTime().substring(0,10);
}
public static String getDateTimeByDate(Date date){
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
Date now = date;
String NDate = formatter.format(now);
return NDate;
}
public static String getDateByDate(Date date){
return getDateTimeByDate(date).substring(0,10);
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -