Swift3 根据日期获取当天零点的时间戳
2017-11-20 本文已影响120人
z小志
func getMorningDate(date:Date) -> Date{
let calendar = NSCalendar.init(identifier: .chinese)
let components = calendar?.components([.year,.month,.day], from: date)
return (calendar?.date(from: components!))!
}