//開始時間
timeBegin+ " 00:00:00";
//結束時間
timeEnd+ " 23:59:59";
//時間轉換
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
//Java時間類型轉換成Long類型(可封裝成工具類)
public static Long stringToLong(String timeStr,SimpleDateFormat sdf){
Date date = null;
try {
date = sdf.parse(timeStr);
} catch (ParseException e) {
e.printStackTrace();
}
//繼續轉換得到秒數的long型
long lTime = date.getTime();
return lTime;
}
//繼續轉換得到秒數的long型
stringToLong(timeBegin+ " 00:00:00", new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"));
?
//Long類型轉換字符串
format.format(Long time);