开发者

Storing hours/minutes in a way I can use with NSDate

开发者 https://www.devze.com 2023-04-01 08:07 出处:网络
I\'m working on an app that is powered by a back-end API web service. There is an en开发者_开发技巧tity being used that has a few properties (such as name etc.) and it also has a time. The time is fix

I'm working on an app that is powered by a back-end API web service. There is an en开发者_开发技巧tity being used that has a few properties (such as name etc.) and it also has a time. The time is fixed in the sense its 10:00AM but its not date specific.

What do you think the best format would be for me to return this time from the API and be able to turn it into a set of NSDateComponents (NSHourCalendarUnit | NSMinuteCalendarUnit) easily and accurately.


You need an NSDateFormatter, from which you get an NSDate. Once you have the NSDate you can do what you want with it.

0

精彩评论

暂无评论...
验证码 换一张
取 消