473,387 Members | 1,535 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

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

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

Aug 2 '06 #1
8 3687
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
Aug 2 '06 #2
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(...), ".", ",")

"Sonnich" <so************@elektrobit.comwrote in message
news:11*********************@p79g2000cwp.googlegro ups.com...
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

Aug 2 '06 #3

Daniel Crichton wrote:
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 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

Aug 2 '06 #4
But is there a server-setting-independent way of doing this?

Yes, create your own function!
Aug 2 '06 #5
Sonnich wrote:
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
Aug 2 '06 #6
Sorry, I left out the link.
http://www.microsoft.com/technet/scr....mspx?mfr=true
Aug 2 '06 #7

Aaron Bertrand [SQL Server MVP] wrote:
But is there a server-setting-independent way of doing this?

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

Aug 3 '06 #8
Sonnich wrote:
Aaron Bertrand [SQL Server MVP] wrote:
>>But is there a server-setting-independent way of doing this?

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.
There's one at the end of this article:
http://www.aspfaq.com/show.asp?id=2313

--
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.
Aug 3 '06 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Muscha | last post by:
Hello, I have a date string in the following format: "2003-10-29T17:44+00:00" When I put it to DateTime.Parse() method it throws an exception, how do I parse this date format? Thanks, /m
4
by: charliewest | last post by:
Hello - I've binded a dataset to a Drop Down List control on my web form, using C#, however, the DateTime value is printed in long format. For example: 04/07/2006 12:00 AM. My code is: ...
2
by: kiran | last post by:
Hi, I am able to create instance of Culture Info for different cultures. How will I get number format as "$ ###,###,##0.00" from CultureInfo.NumberFormat. I need it in this format so that I...
16
by: Al Reid | last post by:
First, I'm using vb2005. I have a string that is read from a barcode reader into a TextBox. The string is 6 characters long and represents a date (mmddyy). I want to display it to the user in a...
5
by: ABC | last post by:
How to initial the datetime variable as value to "01/01/2005 00:00:00"?
7
by: Stimp | last post by:
I want to output a number, say 20, as 20.00 i.e. I want to always have 2 decimal places I don't want any currency information, therefore String.Format("{0:c}") doesn't work for me. Can't...
3
dnb
by: dnb | last post by:
Hi... Thanx for reply.... I don't want concat string... But I want to disply "15,000.00" instead of "15000" in MSHflexgrid. At this time in my MSHflexgrid "15000" format is displayed. ...
0
by: Ronald S. Cook | last post by:
Stupid question for the day but weirdly I don't have this yet. How can I format a textbox such that if the user enters a number like 4 it will become (on validated) 4.00. If they enter 5.1 it...
3
by: Ronald S. Cook | last post by:
Stupid q for the day, but if the user enters 2 in a textbox, I want to display as 2.00. If they enter 2.129 I want it as 2.13. I'm guessing will code in the validated method of the textbox,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.