timestamp 格式 ?加減 天月等;
def subStractOneYear(time:TimeStamp): TimeStamp = ?{
val calendar = Calendar.getInstance()
calendar.setTimeInMillis(time.getTime)
calendar.add(Calendar.YEAR,-1)
new TimeStamp(calendar.getTimeInMillis)
}
判斷時(shí)間日期是否在一個(gè)范圍內(nèi):
caseclassDateRange(startDate:Timestamp, endDate:Timestamp) {
defin(targetDate:Date):Boolean={
targetDate.before(endDate)
&& targetDate.after(startDate)
}
}