Hey guys,
I've been trying to create a stopwatch, and it's all going good except for the way I format my string.
I want the timer to display the time like this: "00:00:00" (hrs:mins:secs).
I tried this: "[NSString stringWithFormat:@"%d:%d:%d", hrs, mins, secs];", but it displays it at "0:0:0".
Does anyone know how to display the time as I want it?
Hey guys,
I've been trying to create a stopwatch, and it's all going good except for the way I format my string.
I want the timer to display the time like this: "00:00:00" (hrs:mins:secs).
I tried this: "[NSString stringWithFormat:@"%d:%d:%d", hrs, mins, secs];", but it displays it at "0:0:0".
Does anyone know how to display the time as I want it?
Check out this password generator app that shows various techniques including using a data container singleton object to share data between objects in your project.
Check out this password generator app that shows various techniques including using a data container singleton object to share data between objects in your project.
Quick question what is the difference between the 3 formats ?Could you give me a small exampe ?
All I know is that:
@"%d:%d:%d" = "0:0:0"
@"%2d:%2d:%2d" = " 0: 0: 0"
@"%02d:%02d:%02d" = "00:00:00"
The only question I have is: why?
What's the syntax for these types of things? I've seen also people writing @"%0.0f" and stuff like that, but I could never distinguish between the differences...
All I know is that:
@"%d:%d:%d" = "0:0:0"
@"%2d:%2d:%2d" = " 0: 0: 0"
@"%02d:%02d:%02d" = "00:00:00"
The only question I have is: why?
What's the syntax for these types of things? I've seen also people writing @"%0.0f" and stuff like that, but I could never distinguish between the differences...