我想知道如何计算登录时间和登出时间之间的差异,例如:登录时间:上午8:00和登出时间:下午5:00,而我应该在总时间内得到9小时。iOS Swift - 计算两次之差
这是被保存到火力
// Set the time
let timeFormatter = DateFormatter()
timeFormatter.dateStyle = .none
timeFormatter.timeStyle = .short
timeFormatter.amSymbol = "AM"
timeFormatter.pmSymbol = "PM"
let timeString = timeFormatter.string(from: date)
可能的重复[使用swift 3和xcode 8在两周内和两天之间的差异](https://stackoverflow.com/questions/42294864/difference-between-2-dates-in-weeks-and-days -using-swift-3-and-xcode-8) – aksh1t
重复的https://stackoverflow.com/a/42017851/2303865 –
@LeoDabus,对不起。感谢提醒。祝你有美好的一天! – TSM