Re: Formatting elapsed time
Re: Formatting elapsed time
- Subject: Re: Formatting elapsed time
- From: Jens Alfke <email@hidden>
- Date: Fri, 07 Sep 2012 14:57:58 -0700
On Sep 7, 2012, at 11:37 AM, Dennis <email@hidden> wrote:
> I'm getting stuck trying to format a variable quantity of elapsed time for the user's locale. The NSDateFormatter class seems to only provide formats for actual times (e.g. "1:30 AM"). What I need to do is turn 1 hour and 30 minutes into "1:30" for my US English settings, and the appropriate string for other locales.
I think the best you can do is generate an NSDate that’s the given elapsed-time past midnight of the current day, and then format it using a formatter that doesn’t include any date or am/pm indicators.
—Jens
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden