T
tony
Hello!
I have this method that take number of seconds(numOfSec) and convert this
into a string with this format hh:mm:ss.
Now to my question there is a small problem when I have time component that
is < 10.
If I pass 7862 seconds to this method I get back "2:11:2" but I want to get
back "02:11:02".
I want this method to fill with 0 where nessesary.
Is it an easy way to do this or do I have to split each time component into
a string.
private string ConvStdTimeToTimeFormat(int numOfSec)
{
return Convert.ToString (sec/3600) + ":" + Convert.ToString ((sec %
3600) / 60 ) + ":" +
Convert.ToString ((sec % 3600) % 60);
}
//Tony
I have this method that take number of seconds(numOfSec) and convert this
into a string with this format hh:mm:ss.
Now to my question there is a small problem when I have time component that
is < 10.
If I pass 7862 seconds to this method I get back "2:11:2" but I want to get
back "02:11:02".
I want this method to fill with 0 where nessesary.
Is it an easy way to do this or do I have to split each time component into
a string.
private string ConvStdTimeToTimeFormat(int numOfSec)
{
return Convert.ToString (sec/3600) + ":" + Convert.ToString ((sec %
3600) / 60 ) + ":" +
Convert.ToString ((sec % 3600) % 60);
}
//Tony