Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Time

Status
Not open for further replies.

bebig

Technical User
Oct 21, 2004
111
US
This code works fine.
the result is
4:45.0
how to get rid of 0?
I hope the result looks like
04:45

Thank you in advance.


set runTime 150
set b 02:15
set b1 [split $b :]
#set b2 [expr {[lindex $b1 0]*3600 + [lindex $b1 1]*60}]
set b3 [lindex $b1 0]
set b4 [lindex $b1 1]

#set result [clock format $b2 -format %k:%M]

set runTimeMin [expr fmod($runTime,60)]
set runTimeHour [expr int($runTime)/60]

#set fullRunTime "$runTimeHour:$runTimeMin"


set result1 [expr {$b3+$runTimeHour}]
set result2 [expr {$b4+$runTimeMin}]

puts "$result1:$result2
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top