简单的获取两日期相差天数
fun getTimeDistance(
year: Int,
month: Int,
day: Int,
checkYear: Int,
checkMonth: Int,
checkDay: Int
): Long {
val format = SimpleDateFormat("yyyyMMdd")
val firstDate = "$year$month$day"
val secondDate = "$checkYear$checkMonth$checkDay"
val date = format.parse(firstDate)
val checkDate = format.parse(secondDate)
val fromCalendar = Calendar.getInstance()
fromCalendar.time = checkDate
val currentCalendar = Calendar.getInstance()
currentCalendar.time = date
return (currentCalendar.timeInMillis - fromCalendar.timeInMillis) / (1000 * 3600 * 24)
}