C# Timer counter in xx.xx.xx format

Posted by Darkshadw on Stack Overflow See other posts from Stack Overflow or by Darkshadw
Published on 2012-04-04T12:46:21Z Indexed on 2012/04/05 5:29 UTC
Read the original article Hit count: 136

Filed under:
|
|
|

I have a counter that counts up every 1 second and add 1 to an int.

Question
How can I format my string so the counter would look like this:

00:01:23

Instead of:

123

Things I've tried
Things I've tried so far:

for (int i = 0; i < 1; i++)
        {
            _Counter += 1;
            labelUpTime.Text = _Counter.ToString();
        }

My timer's interval is set to: 1000 (so it adds 1 every second).
I did read something about string.Format(""), but I don't know if it is applicable.
Thanks if you can guide me through this :D!

© Stack Overflow or respective owner

Related posts about c#

Related posts about timer