Swift3 根據日期獲取當天零點的時間戳

z小志發表於2018-01-23
 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!))!
    }
複製程式碼

相關文章