小编Swi*_*per的帖子

如何用文字表达当前时间

我能够获得当前时间,现在我想用文字输出它。

let date = Date()
let calendar = Calendar.current
let hour = calendar.component(.hour, from: date)
let minutes = calendar.component(.minute, from: date)
let seconds = calendar.component(.second, from: date)
print("hours = \(hour):\(minutes):\(seconds)")
Run Code Online (Sandbox Code Playgroud)

输出

10:30

如何得到这个 -

现在是十点半了

foundation swift

-2
推荐指数
1
解决办法
466
查看次数

标签 统计

foundation ×1

swift ×1