Re: Number Format, Padded Form
- To: mathgroup at smc.vnet.net
- Subject: [mg21374] Re: Number Format, Padded Form
- From: "Allan Hayes" <hay at haystack.demon.co.uk>
- Date: Wed, 29 Dec 1999 23:18:47 -0500 (EST)
- References: <84dmpo$30h@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Charles,
Table[ToString[Quotient[minsec2, 60]] <> ":" <>
StringTake["00" <> ToString[Mod[minsec2, 60]], -2], {minsec2, 56, 146,
2}]
{"0:56", "0:58", "1:00", "1:02", "1:04", "1:06", "1:08", "1:10", "1:12", \
"1:14", "1:16", "1:18", "1:20", "1:22", "1:24", "1:26", "1:28", "1:30", \
"1:32", "1:34", "1:36", "1:38", "1:40", "1:42", "1:44", "1:46", "1:48", \
"1:50", "1:52", "1:54", "1:56", "1:58", "2:00", "2:02", "2:04", "2:06", \
"2:08", "2:10", "2:12", "2:14", "2:16", "2:18", "2:20", "2:22", "2:24", \
"2:26"}
Allan
---------------------
Allan Hayes
Mathematica Training and Consulting
Leicester UK
www.haystack.demon.co.uk
hay at haystack.demon.co.uk
Voice: +44 (0)116 271 4198
Fax: +44 (0)870 164 0565
"Charles A. Judge" <kinky at chesapeake.net> wrote in message
news:84dmpo$30h at smc.vnet.net...
> 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
>
>
>
>