Oct 22, 2004 #1 bebig Technical User Oct 21, 2004 111 US I was trying to convert 150min to 2:30. But I got error Would you please help me? code>> set runTime 150 set runTimeMin [expr fmod($runTime,60)] set runTimeHour [expr int($runTime,60)] set fullRunTime "$runTimeMin : $runTimeHour" puts $fullRuntime
I was trying to convert 150min to 2:30. But I got error Would you please help me? code>> set runTime 150 set runTimeMin [expr fmod($runTime,60)] set runTimeHour [expr int($runTime,60)] set fullRunTime "$runTimeMin : $runTimeHour" puts $fullRuntime
Oct 22, 2004 Thread starter #2 bebig Technical User Oct 21, 2004 111 US set runTime 150 set runTimeMin [expr fmod($runTime,60)] set runTimeHour [expr int($runTime)/60)] --> I changed int($runTime.60) to int($runTime)/60 set fullRunTime "$runTimeMin : $runTimeHour" puts $fullRuntime this code works for me. is it logically correct?? Upvote 0 Downvote
set runTime 150 set runTimeMin [expr fmod($runTime,60)] set runTimeHour [expr int($runTime)/60)] --> I changed int($runTime.60) to int($runTime)/60 set fullRunTime "$runTimeMin : $runTimeHour" puts $fullRuntime this code works for me. is it logically correct??
Oct 22, 2004 #3 cptk Technical User Mar 18, 2003 305 US I bet you were getting an error to the effect "...not enough arguments for the the function", or something like that. Anyway, it's simple: > set runTimeMin [expr int(fmod($runTime,60))] > set runTimeHour [expr int($runTime/60)] > set fullRunTime "$runTimeMin : $runTimeHour" To get a little fancier, use the format cmd to make the hour and minute variables always be two digits (i.e. - 02:30). > format "%02s" yourvariable ...where the arg flags "0" is for zero padding and "2" is the width. Upvote 0 Downvote
I bet you were getting an error to the effect "...not enough arguments for the the function", or something like that. Anyway, it's simple: > set runTimeMin [expr int(fmod($runTime,60))] > set runTimeHour [expr int($runTime/60)] > set fullRunTime "$runTimeMin : $runTimeHour" To get a little fancier, use the format cmd to make the hour and minute variables always be two digits (i.e. - 02:30). > format "%02s" yourvariable ...where the arg flags "0" is for zero padding and "2" is the width.