MathGroup Archive 1999

[Date Index] [Thread Index] [Author Index]

Search the Archive

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
>
>
>
>
>



  • Prev by Date: Re: A better way to decimate a file??
  • Next by Date: Re: Newbie question about rules
  • Previous by thread: Number Format, Padded Form
  • Next by thread: Re: Number Format, Padded Form