NSTimeInterval Formatting

后端 未结 5 905
梦谈多话
梦谈多话 2020-12-02 19:51

I want to take my NSTimeInterval and format it into a string as 00:00:00 (hours, minutes, seconds). What is the best way to do this?

5条回答
  •  萌比男神i
    2020-12-02 20:44

    Since iOS 8.0 there is now NSDateComponentsFormatter which has a stringFromTimeInterval: method.

    [[NSDateComponentsFormatter new] stringFromTimeInterval:timeInterval];
    

提交回复
热议问题