How to ensure 2 places to right of decimal

Ask a Question related to ASP Database, Design and Development.

  1. #1

    Default How to ensure 2 places to right of decimal

    How can I make certain that decimal values print out 2
    places to the right all the time when displaying them on
    a website coming from an Access database. Its defined in
    the database as a Number, Single, Auto, should I make it
    Number, single, 2? I need it to print out like shown
    below.


    Ex:

    1.5 should print out like this 1.50

    2.375 should print out like this 2.37

    3 should print out like this 3.00

    Thanks and Happy Holidays,

    Shawn
    Shawn Guest

  2. Similar Questions and Discussions

    1. Added decimal places
      In my tables my number values look right, but when I use a query to to subtractions, I'm getting slightly wrong numbers. For example, I have begin...
    2. To 2 decimal places
      Folks, I know some of you here are extremely dynamic. I am working with a variable that is declared as a decimal. But I want to convert the...
    3. Decimal places!
      Hi fellow Director users!, I had a countdown timer (75 seconds) for a game, and I wanted to display the time taken to complete it, in a field. ...
    4. Finding Decimal Places
      Does anyone know how to find out the number of decimal places a number has. I need this info so that i can round to 3 decimal places if the number...
    5. do not cut decimal places
      Hi, following problem (oracle8): I want to insert a value with precision (#.##) in a number(10,2) column. It works but the values which end with...
  3. #2

    Default Re: How to ensure 2 places to right of decimal

    Are you using ASP? If you are using VBScript in your ASP page, then you can
    use the FormatNumber() function

    FormatNumber(Expression [,NumDigitsAfterDecimal [,IncludeLeadingDigit
    [,UseParensForNegativeNumbers [,GroupDigits]]]])Arguments
    Expression
    Required. Expression to be formatted.
    NumDigitsAfterDecimal
    Optional. Numeric value indicating how many places to the right of the
    decimal are displayed. Default value is -1, which indicates that the
    computer's regional settings are used.
    IncludeLeadingDigit
    Optional. Tristate constant that indicates whether or not a leading zero
    is displayed for fractional values. See Settings section for values.
    UseParensForNegativeNumbers
    Optional. Tristate constant that indicates whether or not to place
    negative values within parentheses. See Settings section for values.
    GroupDigits
    Optional. Tristate constant that indicates whether or not numbers are
    grouped using the group delimiter specified in the control panel. See
    Settings section for values.


    Cheers
    Ken

    "Shawn" <programming@jards.com> wrote in message
    news:032801c3c9b8$b96ab750$a501280a@phx.gbl...
    : How can I make certain that decimal values print out 2
    : places to the right all the time when displaying them on
    : a website coming from an Access database. Its defined in
    : the database as a Number, Single, Auto, should I make it
    : Number, single, 2? I need it to print out like shown
    : below.
    :
    :
    : Ex:
    :
    : 1.5 should print out like this 1.50
    :
    : 2.375 should print out like this 2.37
    :
    : 3 should print out like this 3.00
    :
    : Thanks and Happy Holidays,
    :
    : Shawn


    Ken Schaefer Guest

  4. #3

    Default Re: How to ensure 2 places to right of decimal

    And just for reference here are some more VBScript (i.e. ASP) functions
    too:

    VBScript Functions
    [url]http://www.w3schools.com/vbscript/vbscript_ref_functions.asp[/url]

    Best regards,
    J. Paul Schmidt, Freelance ASP Web Developer
    [url]http://www.Bullschmidt.com[/url]
    ASP Design Tips, ASP Web Database Demo, Free ASP Bar Chart Tool...


    *** Sent via Developersdex [url]http://www.developersdex.com[/url] ***
    Don't just participate in USENET...get rewarded for it!
    Bullschmidt Guest

Posting Permissions

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139