Results 1 to 5 of 5

Thread: formatnumber

  1. #1
    taukay Guest

    Default formatnumber

    i use formatnumber to round my floating number eg: formatnumber(number,2) but if how my number is only 1 percision eg:2.3 how do i round it to 2.30 ?<BR>please help thanks<BR>

  2. #2
    Join Date
    Dec 1969

    Default RE: formatnumber

    At least on my development environment, this already does format it to 2.30.<BR><BR><BR>HTH<BR><BR>Jerry

  3. #3
    Skippie Guest

    Default RE: formatnumber

    There is a function called Round:<BR><BR>&#060;%<BR>x = 1234.5678<BR>x = Round(x,2)<BR>%&#062;<BR><BR>Now x is 1234.57<BR><BR><BR>-- Skippie<BR><BR>

  4. #4
    Skippie Guest

    Default Opps! Sorry!

    That doesn&#039t work for the one precision number rounding to two.<BR><BR>-- Skippie<BR>

  5. #5
    Skippie Guest

    Default You have to change it to a string.

    If you do this:<BR><BR>&#060;%<BR>Response.Write(1234.50) <BR>%&#062;<BR><BR>The browser will display this: 1234.5<BR><BR>You should write a separate function that will return a <BR>string, and then display the string.<BR><BR>If you are only concerned with two digits, then it&#039s easy!<BR>Convert it to currency first, then remove the $ sign.<BR><BR>This should work:<BR><BR>&#060;%<BR>x = 1234.5<BR>s = FormatCurrency(x)<BR>s = Replace(s,"$","")<BR>s = Replace(s,",","")<BR>Response.Write(s)<BR>%&#062;< BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts