Re: Number Format, Padded Form
- To: mathgroup at smc.vnet.net
- Subject: [mg21372] Re: [mg21357] Number Format, Padded Form
- From: "David Park" <djmp at earthlink.net>
- Date: Wed, 29 Dec 1999 23:18:45 -0500 (EST)
- Sender: owner-wri-mathgroup at wolfram.com
Charles, I think this will work: MinSecFormat[seconds_?Positive] := Module[{min, sec}, min = IntegerPart[seconds/60]; sec = IntegerPart[seconds - 60min]; SequenceForm[PaddedForm[min, 2], ":", PaddedForm[sec, 2, NumberPadding -> {"0", "0"}, NumberSigns -> {"", ""}]] ] MinSecFormat[145] 2:25 David Park djmp at earthlink.net http://home.earthlink.net/~djmp/ >I need to make a table of times in seconds, expressed in the format min:sec > >58 >59 >1:00 >1:01 >1:02 etc. > >Table[StringForm["``:``", IntegerPart[minsec2/60.], > PaddedForm[minsec2 - IntegerPart[minsec2/60]*60, {1, 0}, > NumberPadding -> {"0", "0"}]], {minsec2, 56, 146, 2}] > >will correctly format the 1:04 1:06 numbers, but adds an extra zero to >numbers above 9 seconds. > > >0:058 > >1:010 > > >Any suggestions? > > >Charles A. Judge > > > > >