How to knock off decimal places..

Discussion in 'ASP General' started by Davey, Dec 5, 2005.

  1. Davey

    Davey Guest

    I have some code that divides a number and then prints this number. It
    performs a cost rollup basically and then adds a percentage. The code works
    fine except that the number returned has many figures afert the decimal
    point (as you would expect really)
    How can I remove these ? I am not really concerned about rounding up or
    down, just removing to give me a whole number....

    Many Thanks
    Davey
     
    Davey, Dec 5, 2005
    #1
    1. Advertising

  2. Davey

    Evertjan. Guest

    Davey wrote on 05 dec 2005 in microsoft.public.inetserver.asp.general:

    > I have some code that divides a number and then prints this number. It
    > performs a cost rollup basically and then adds a percentage. The code
    > works fine except that the number returned has many figures afert the
    > decimal point (as you would expect really)
    > How can I remove these ? I am not really concerned about rounding up
    > or down, just removing to give me a whole number....


    If you are programming in ASP-vbScript:

    formatnumber()

    This is very basic, please read up on vbscript internal functions.

    --
    Evertjan.
    The Netherlands.
    (Replace all crosses with dots in my emailaddress)
     
    Evertjan., Dec 5, 2005
    #2
    1. Advertising

  3. Davey

    Davey Guest

    No problem. I have found it !!

    "Davey" <> wrote in message
    news:O9sPUmY%...
    > I have some code that divides a number and then prints this number. It
    > performs a cost rollup basically and then adds a percentage. The code

    works
    > fine except that the number returned has many figures afert the decimal
    > point (as you would expect really)
    > How can I remove these ? I am not really concerned about rounding up or
    > down, just removing to give me a whole number....
    >
    > Many Thanks
    > Davey
    >
    >
     
    Davey, Dec 5, 2005
    #3
  4. Davey

    Davey Guest

    Hi Evertjan,

    I have used the FormatNumber() as you suggest. However, I am also using the
    FormatCurrency() to display a cost as currency. This works fine but I get
    different currency symbols on different servers !
    I have checked the Regional Settings in control on both servers and they are
    both set the same, but one displays $, and the other displays £....
    Any ideas why this should be ??

    Cheers
    Davey


    "Evertjan." <> wrote in message
    news:Xns97237BBF763D6eejj99@194.109.133.242...
    > Davey wrote on 05 dec 2005 in microsoft.public.inetserver.asp.general:
    >
    > > I have some code that divides a number and then prints this number. It
    > > performs a cost rollup basically and then adds a percentage. The code
    > > works fine except that the number returned has many figures afert the
    > > decimal point (as you would expect really)
    > > How can I remove these ? I am not really concerned about rounding up
    > > or down, just removing to give me a whole number....

    >
    > If you are programming in ASP-vbScript:
    >
    > formatnumber()
    >
    > This is very basic, please read up on vbscript internal functions.
    >
    > --
    > Evertjan.
    > The Netherlands.
    > (Replace all crosses with dots in my emailaddress)
    >
     
    Davey, Dec 6, 2005
    #4
  5. It's because you are not looking at the correct Regional Settings. When you
    look at Regional Settings, you are looking at your OWN settings. ASP runs
    under a different user account. The default user account settings is US. You
    should consider setting LCID in your application:
    http://www.aspfaq.com/show.asp?id=2260

    Davey wrote:
    > Hi Evertjan,
    >
    > I have used the FormatNumber() as you suggest. However, I am also
    > using the FormatCurrency() to display a cost as currency. This works
    > fine but I get different currency symbols on different servers !
    > I have checked the Regional Settings in control on both servers and
    > they are both set the same, but one displays $, and the other
    > displays £....
    > Any ideas why this should be ??
    >
    > Cheers
    > Davey
    >
    >
    > "Evertjan." <> wrote in message
    > news:Xns97237BBF763D6eejj99@194.109.133.242...
    >> Davey wrote on 05 dec 2005 in
    >> microsoft.public.inetserver.asp.general:
    >>
    >>> I have some code that divides a number and then prints this number.
    >>> It performs a cost rollup basically and then adds a percentage. The
    >>> code works fine except that the number returned has many figures
    >>> afert the decimal point (as you would expect really)
    >>> How can I remove these ? I am not really concerned about rounding up
    >>> or down, just removing to give me a whole number....

    >>
    >> If you are programming in ASP-vbScript:
    >>
    >> formatnumber()
    >>
    >> This is very basic, please read up on vbscript internal functions.
    >>
    >> --
    >> Evertjan.
    >> The Netherlands.
    >> (Replace all crosses with dots in my emailaddress)


    --
    Microsoft MVP -- ASP/ASP.NET
    Please reply to the newsgroup. The email account listed in my From
    header is my spam trap, so I don't check it very often. You will get a
    quicker response by posting to the newsgroup.
     
    Bob Barrows [MVP], Dec 6, 2005
    #5
  6. Davey

    Evertjan. Guest

    Davey wrote on 06 dec 2005 in microsoft.public.inetserver.asp.general:
    > "Evertjan." <> wrote in message
    >> Davey wrote on 05 dec 2005 in
    >> microsoft.public.inetserver.asp.general:
    >>
    >> > I have some code that divides a number and then prints this number.
    >> > It performs a cost rollup basically and then adds a percentage. The
    >> > code works fine except that the number returned has many figures
    >> > afert the decimal point (as you would expect really)
    >> > How can I remove these ? I am not really concerned about rounding
    >> > up or down, just removing to give me a whole number....

    >>
    >> If you are programming in ASP-vbScript:
    >>
    >> formatnumber()
    >>
    >> This is very basic, please read up on vbscript internal functions.
    >>


    [please do not toppost on usenet]

    > I have used the FormatNumber() as you suggest. However, I am also
    > using the FormatCurrency() to display a cost as currency. This works
    > fine but I get different currency symbols on different servers !
    > I have checked the Regional Settings in control on both servers and
    > they are both set the same, but one displays $, and the other displays
    > £.... Any ideas why this should be ??


    Never use FormatCurrency() in an internet setting, as both the server
    regional settings and the clients available fonts have influence.

    <% = "€&nbsp;" & FormatNumber(yourGainOrLoss,2) %>

    will do what you(?) want.

    In general avoid coding that is dependent on regional settings,
    though both the decimal and thousands character
    are influenced by it in FormatNumber()

    € 1.234,56

    or

    € 1,234.56

    or ....



    --
    Evertjan.
    The Netherlands.
    (Replace all crosses with dots in my emailaddress)
     
    Evertjan., Dec 6, 2005
    #6
  7. Davey

    Davey Guest

    Thanks Evertjan.

    I see what you mean with using the FormatCurrency.

    Thankyou for your help
    Cheers
    Davey


    "Evertjan." <> wrote in message
    news:Xns97249DF46A616eejj99@194.109.133.242...
    > Davey wrote on 06 dec 2005 in microsoft.public.inetserver.asp.general:
    > > "Evertjan." <> wrote in message
    > >> Davey wrote on 05 dec 2005 in
    > >> microsoft.public.inetserver.asp.general:
    > >>
    > >> > I have some code that divides a number and then prints this number.
    > >> > It performs a cost rollup basically and then adds a percentage. The
    > >> > code works fine except that the number returned has many figures
    > >> > afert the decimal point (as you would expect really)
    > >> > How can I remove these ? I am not really concerned about rounding
    > >> > up or down, just removing to give me a whole number....
    > >>
    > >> If you are programming in ASP-vbScript:
    > >>
    > >> formatnumber()
    > >>
    > >> This is very basic, please read up on vbscript internal functions.
    > >>

    >
    > [please do not toppost on usenet]
    >
    > > I have used the FormatNumber() as you suggest. However, I am also
    > > using the FormatCurrency() to display a cost as currency. This works
    > > fine but I get different currency symbols on different servers !
    > > I have checked the Regional Settings in control on both servers and
    > > they are both set the same, but one displays $, and the other displays
    > > £.... Any ideas why this should be ??

    >
    > Never use FormatCurrency() in an internet setting, as both the server
    > regional settings and the clients available fonts have influence.
    >
    > <% = "?&nbsp;" & FormatNumber(yourGainOrLoss,2) %>
    >
    > will do what you(?) want.
    >
    > In general avoid coding that is dependent on regional settings,
    > though both the decimal and thousands character
    > are influenced by it in FormatNumber()
    >
    > ? 1.234,56
    >
    > or
    >
    > ? 1,234.56
    >
    > or ....
    >
    >
    >
    > --
    > Evertjan.
    > The Netherlands.
    > (Replace all crosses with dots in my emailaddress)
    >
     
    Davey, Dec 7, 2005
    #7
    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. Chinmay

    Knock...!!! Knock...!!! New Offer...

    Chinmay, Apr 26, 2008, in forum: C Programming
    Replies:
    0
    Views:
    286
    Chinmay
    Apr 26, 2008
  2. Chinmay

    Knock...!!! Knock...!!! New Offer...

    Chinmay, Apr 26, 2008, in forum: C Programming
    Replies:
    0
    Views:
    250
    Chinmay
    Apr 26, 2008
  3. birdsong
    Replies:
    3
    Views:
    455
    Ishwor Gurung
    Oct 21, 2009
  4. *stella*

    Knock, knock

    *stella*, May 19, 2005, in forum: Javascript
    Replies:
    0
    Views:
    154
    *stella*
    May 19, 2005
  5. Matt
    Replies:
    2
    Views:
    78
Loading...

Share This Page