FormatNumber

Discussion in 'ASP General' started by MiniEggs, Dec 4, 2009.

  1. MiniEggs

    MiniEggs Guest

    Hi

    Why would FormatNumber(1,2,0,0,0) return 1,00 instead of 1.00 ?

    All docs I've found on the web suggest it should return 1.00

    Thanks in advance
    MiniEggs, Dec 4, 2009
    #1
    1. Advertising

  2. MiniEggs

    Tim Slattery Guest

    "MiniEggs" <> wrote:

    >Hi
    >
    >Why would FormatNumber(1,2,0,0,0) return 1,00 instead of 1.00 ?


    Check the "Regional and Language Options" control panel applet on the
    server, that's what controls this. Europeans use a comma to separate
    the fraction from the integer, the US uses a period. You probably want
    to set the region to "English, United States".

    --
    Tim Slattery

    http://members.cox.net/slatteryt
    Tim Slattery, Dec 4, 2009
    #2
    1. Advertising

  3. MiniEggs

    MiniEggs Guest

    Hi Tim

    Thanks for the reply

    I have asked for this to be checked

    The odd thing is though all three of these return the same result

    Response.Write FormatNumber(1,2,-2,-2,-2)
    Response.Write FormatNumber(1,2,-1,-1,-1)
    Response.Write FormatNumber(1,2,0,0,0)

    I would have thought 0 should mean the regional settings are ignored ?

    Thanks

    "Tim Slattery" <> wrote in message
    news:...
    > "MiniEggs" <> wrote:
    >
    >>Hi
    >>
    >>Why would FormatNumber(1,2,0,0,0) return 1,00 instead of 1.00 ?

    >
    > Check the "Regional and Language Options" control panel applet on the
    > server, that's what controls this. Europeans use a comma to separate
    > the fraction from the integer, the US uses a period. You probably want
    > to set the region to "English, United States".
    >
    > --
    > Tim Slattery
    >
    > http://members.cox.net/slatteryt
    MiniEggs, Dec 4, 2009
    #3
  4. MiniEggs

    Bob Barrows Guest

    Tim Slattery wrote:
    > "MiniEggs" <> wrote:
    >
    >> Hi
    >>
    >> Why would FormatNumber(1,2,0,0,0) return 1,00 instead of 1.00 ?

    >
    > Check the "Regional and Language Options" control panel applet on the
    > server, that's what controls this. Europeans use a comma to separate
    > the fraction from the integer, the US uses a period. You probably want
    > to set the region to "English, United States".
    >

    One gotcha here is that the user profile whose Regional Settings are
    manifesting in ASP might not be the user profile under which you are
    logging into the server to check the Regional Settings. It might be the
    IUSR account depending on how the website is configured. There are
    several KB articles that deal with this issue so let me point you at
    these search results:
    http://www.google.com/search?source...Settings" IIS ASP site:support.microsoft.com

    --
    HTH,
    Bob Barrows
    Bob Barrows, Dec 4, 2009
    #4
  5. MiniEggs

    Bob Barrows Guest

    No. None of these arguments affects the decimal separator used. The last
    argument will affect the thousands separator, but that's it.
    I try to avoid formatnumber, formatdate and formatcurrency, for these
    reasons. If I need to format a string, I do it explicitly. See
    http://www.aspfaq.com/show.asp?id=2313 for some suggestions.

    MiniEggs wrote:
    > Hi Tim
    >
    > Thanks for the reply
    >
    > I have asked for this to be checked
    >
    > The odd thing is though all three of these return the same result
    >
    > Response.Write FormatNumber(1,2,-2,-2,-2)
    > Response.Write FormatNumber(1,2,-1,-1,-1)
    > Response.Write FormatNumber(1,2,0,0,0)
    >
    > I would have thought 0 should mean the regional settings are ignored ?
    >
    > Thanks
    >
    > "Tim Slattery" <> wrote in message
    > news:...
    >> "MiniEggs" <> wrote:
    >>
    >>> Hi
    >>>
    >>> Why would FormatNumber(1,2,0,0,0) return 1,00 instead of 1.00 ?

    >>
    >> Check the "Regional and Language Options" control panel applet on the
    >> server, that's what controls this. Europeans use a comma to separate
    >> the fraction from the integer, the US uses a period. You probably
    >> want to set the region to "English, United States".
    >>
    >> --
    >> Tim Slattery
    >>
    >> http://members.cox.net/slatteryt


    --
    HTH,
    Bob Barrows
    Bob Barrows, Dec 4, 2009
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. eddie wang

    formatnumber function returns error

    eddie wang, Feb 10, 2004, in forum: ASP General
    Replies:
    11
    Views:
    507
    Bob Barrows [MVP]
    Feb 11, 2004
  2. Lakrom

    Error with FormatNumber sentence

    Lakrom, Dec 16, 2004, in forum: ASP General
    Replies:
    4
    Views:
    130
    Lakrom
    Dec 16, 2004
  3. Greg
    Replies:
    3
    Views:
    136
    Dr John Stockton
    Sep 14, 2003
Loading...

Share This Page