I'm using an NSDateFormatter to format a duration of time (see here).
I want to use a format that goes like this: "3 hours, 15 minutes".
Here's the format string I'm using: @"H' hours, 'm' minutes'"
.
The issue is that, for durations shorter than one hour, the result is something like "0 hours, 35 minutes".
I simply want to show "35 minutes" in cases like that.
Is there a way to tell NSDateFormatter not to show hours at all if there aren't any, or should I just use an if statement and construct the string manually?
Edit:
I'm well aware that this is easy to do manually with a couple extra lines, which is how I've done it in the past. I'm just wondering if the formatter has enough smarts to handle this on its own since it seems like a common problem.