NSTimeInterval to HH:mm:ss?

后端 未结 12 1769
陌清茗
陌清茗 2020-12-04 08:53

If I have an NSTimeInterval that is set to say 200.0, is there a way to convert that into 00:03:20, I was thinking I could initialise an NSDate with it and then use NSDateFo

12条回答
  •  挽巷
    挽巷 (楼主)
    2020-12-04 09:24

    Swift 4

    DateComponentsFormatter().string(from: <# TimeInterval #>)
    

    ex:

    DateComponentsFormatter().string(from: 59.0)
    

提交回复
热议问题