How to Format a Number in Classic ASP

Posted on 2008-10-03
Last Modified: 2010-04-21

In a Classic ASP application I have a value in a variable that contains a number in bytes (example 2389977645).  I want to display it so as it uses commas.  I have found the FormatNumber() function useless in this area.

Example preferred output: 2,389,977,645

What can you recommend?


Question by:michael4606
LVL 39

Expert Comment

ID: 22634470
vbscript or jscript?
LVL 82

Accepted Solution

hielo earned 65 total points
ID: 22634493
I just tried:
Response.Write( FormatNumber("2389977645",0))

and it works.
LVL 39

Assisted Solution

BrandonGalderisi earned 30 total points
ID: 22634500

wscript.echo formatnumber ("12345",0)

produces 12,345 for me

What does it do for you?

Here's a reference for the command.  You may have to override some regional settings:

Assisted Solution

by:Brad Dobyns, CSM
Brad Dobyns, CSM earned 30 total points
ID: 22634502
It depends on your regional settings but that should work:
<%= FormatNumber(myNumber,0) %>

Open in new window


Author Closing Comment

ID: 31502775
Thanks guys it was my error using the function wrong.  You set me straight.

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

Running classic asp applications under Windows Server 2008 R2 (x64) and IIS 7 is not as easy as one may think. It took me a while to figure it out while getting error 8002801d a few times. After you install the OS you will need to install the fol…
When it comes to showing a 404 error page to your visitors, you do not want that generic page to show, and you especially do not want your hosting provider’s ad error page to show either. In this article, I will show you how to enable the custom 40…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

760 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now