|
-
Jul 15th, 2004, 03:24 PM
#1
Thread Starter
Frenzied Member
Format TimeSpan
I'm thinking this should be easy, but I can't figure out how to format a TimeSpan object the way I'd like it displayed.
I'd like to display as hh:mm:ss - that is, without the milliseconds. Can anyone help me out?
Thanks,
Mike
-
Jul 17th, 2004, 10:44 AM
#2
Thread Starter
Frenzied Member
FWIW, this is the simplest I could come up with, this is in C#
PHP Code:
timeSpan.ToString().Substring(0, timeSpan.ToString().LastIndexOf("."));
-
Jul 18th, 2004, 09:54 PM
#3
Fanatic Member
this?
VB Code:
dim tm as timespan
. . .
string.format("{0}:{1}:{2}",tm.hours,tm.minutes,tm.seconds)
if not, sorry.
-
Jul 19th, 2004, 08:54 AM
#4
Thread Starter
Frenzied Member
That kind of works, but I (or my users I should say) want it formatted with leading zeros, if need be. Also (this would be easy to add to your code), number of days should be part of the result. This is why I used LastIndexOf, instead of IndexOf.
Thanks,
Mike
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|