Swift3 根据日期获取当天零点的时间戳

 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!))!
    }

你可能感兴趣的:(Swift3 根据日期获取当天零点的时间戳)