import org.apache.commons.lang3.time.FastDateFormat;
import java.sql.Timestamp;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*;
public static String getCurrentDateStr() {
return getCurrentDate("yyyy-MM-dd");
}
public static String getCurrentDate(String aFormat) {
TimeZone time = TimeZone.getTimeZone("GMT+8"); // 设置为东八区
time = TimeZone.getDefault();// 这个是国际化所用的
TimeZone.setDefault(time);// 设置时区
Calendar calendar = Calendar.getInstance();// 获取实例
DateFormat format1 = new SimpleDateFormat(aFormat);// 构造格式化模板
Date date = calendar.getTime(); // 获取Date对象
String tDate = format1.format(date);
return tDate;
}