Swift 代码
/// 某一天零点时刻的 timeInterval
///
/// - Parameter date: 某个日期
/// - Returns: timeInterval
private func someDayZeroClockTimeInterval(date: Date) -> TimeInterval {
let calendar = Calendar.current
var compoents = calendar.dateComponents([.year, .month, .day], from: Date.init())
let date = calendar.date(from: compoents)!
let interval = date.timeIntervalSinceReferenceDate
return interval
}
网友评论