format(a, "#0.00") - can it really be that hard?

S

Sonnich

Yes it can.

All I want is a number formated as:

1234567,89 - plain numbers and a comma as decimal marker.

formatnumber returns the number in american style, which is of no use.
The format command does not exist.

And the help for ASP really sucks, when compared to php.org. Is there
such a place for asp?
That would save me for a lot of time, I spend too much time on simple
things like this when working with ASP.
Odd that a simple question has to end here after 4 hrs of trying.

S
 
D

Daniel Crichton

Sonnich wrote on 2 Aug 2006 04:16:32 -0700:
Yes it can.

All I want is a number formated as:

1234567,89 - plain numbers and a comma as decimal marker.

formatnumber returns the number in american style, which is of no use.

Formatnumber uses the regional setting for the IIS account. The server you
are running this ASP on doesn't have the appropriate regional setting. Try this:

Replace(FormatNumber(a,2),".",",")

This will format is to 2 decimal places, and replace the . with a ,
The format command does not exist.

It's not a VB script command.
And the help for ASP really sucks, when compared to php.org. Is there
such a place for asp?

Many sites have hints and tips, such as www.aspfaq.com . Searching on Google
for asp will bring up plenty of information.
That would save me for a lot of time, I spend too much time on simple
things like this when working with ASP.
Odd that a simple question has to end here after 4 hrs of trying.

Dan
 
A

Aaron Bertrand [SQL Server MVP]

ASP functionality in terms of dates and numbers are dictated by the regional
settings on the server. If you want commas as decimal markers, then change
the regional settings for decimal markers from periods to commas.

Or take the simple approach.

replace(formatnumber(...), ".", ",")
 
S

Sonnich

Daniel said:
Sonnich wrote on 2 Aug 2006 04:16:32 -0700:


Formatnumber uses the regional setting for the IIS account. The server you
are running this ASP on doesn't have the appropriate regional setting. Try this:

Replace(FormatNumber(a,2),".",",")

This will format is to 2 decimal places, and replace the . with a ,

The current server will return - 123,456.798 (yanke format). So with a
little change this works:

replace( replace( formatNumber(rs.fields(fieldnumber), 2), ",",""),
".",",")

which will give 123456,80.

But is there a server-setting-independent way of doing this?

S
 
A

Aaron Bertrand [SQL Server MVP]

But is there a server-setting-independent way of doing this?

Yes, create your own function!
 
M

MikeR

Sonnich said:
And the help for ASP really sucks, when compared to php.org. Is there
such a place for asp?
ASP is NOT a language, but a technology. Here is a link to a pretty good
vbscript reference. I try not to use javascript, so I have no reference to it.
HTH.
Mike
 
S

Sonnich

Aaron said:
Yes, create your own function!

I was about to do that, but then I found how complicated it is to get
the local settings etc.

I ended up with something simpler. Enetually I might try to make a
format( function and share it here though.

Sonnich
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,021
Latest member
AkilahJaim

Latest Threads

Top