// 其中 starStr, stopStr 为字符串类型,结构类似“2020-01-01”
let formatter = DateFormatter()
formatter.dateFormat = "yyyy-MM-dd"
let tempStart = formatter.date(from: starStr!)
let tempStop = formatter.date(from: stopStr!)
let intervalStart = tempStart!.timeIntervalSince1970
let intervalStop = tempStop!.timeIntervalSince1970
if intervalStart > intervalStop {
print("结束时间不能早于开始时间")
return
}