【发布时间】:2017-09-27 01:45:22
【问题描述】:
我想知道如何计算登录时间和注销时间之间的差异,例如:登录时间:上午 8:00 和注销时间:下午 5:00,我应该得到 9 小时作为总小时数渲染。
这是保存到 Firebase 的时间格式
// Set the time
let timeFormatter = DateFormatter()
timeFormatter.dateStyle = .none
timeFormatter.timeStyle = .short
timeFormatter.amSymbol = "AM"
timeFormatter.pmSymbol = "PM"
let timeString = timeFormatter.string(from: date)
【问题讨论】:
-
@LeoDabus,对不起。感谢您的提醒。祝你有美好的一天!
-
@LeoDabus,我尝试了您在该帖子中发布的解决方案,这正是我所需要的。在问这个问题之前,我应该看得更远,本可以找到你的帖子。非常感谢!再次,我很抱歉提出这个问题。
-
@TSM 欢迎您。