Date 时差8小时解决方法
2018-12-07 本文已影响13人
幸运者_Lucky
let date = Date()
let zone = NSTimeZone.local
let interval: NSInteger = zone.secondsFromGMT(for: date)
let now = date.addingTimeInterval(TimeInterval(interval))
print(date, now)
let date = Date()
let zone = NSTimeZone.local
let interval: NSInteger = zone.secondsFromGMT(for: date)
let now = date.addingTimeInterval(TimeInterval(interval))
print(date, now)