|
-
Oct 6th, 2000, 04:45 AM
#1
Thread Starter
Addicted Member
Hello everyone,
This probably sounds really stupid, but can anyone tell me how to fromat numbers into two decimal places. I'm really stuck on this one - never had to do it before, and all the books I've seen just describe the ecimal data type.
Cheers
Skeen
"It wasn't the booze that made me snooze, It was the Gin that did me in!"
-
Oct 6th, 2000, 05:12 AM
#2
Fanatic Member
Hi skeen
sorry I didn't reply by ICQ (few problems with my computer)
To format numbers you use FormatNumber (wow, now that's uncanny)
here it is(taken from msdn)
FormatNumber(Expression [,NumDigitsAfterDecimal [,IncludeLeadingDigit [,UseParensForNegativeNumbers [,GroupDigits]]]])
Arguments
Expression
Required. Expression to be formatted.
NumDigitsAfterDecimal
Optional. Numeric value indicating how many places to the right of the decimal are displayed. Default value is -1, which indicates that the computer's regional settings are used.
IncludeLeadingDigit
Optional. Tristate constant that indicates whether or not a leading zero is displayed for fractional values. See Settings section for values.
UseParensForNegativeNumbers
Optional. Tristate constant that indicates whether or not to place negative values within parentheses. See Settings section for values.
GroupDigits
Optional. Tristate constant that indicates whether or not numbers are grouped using the group delimiter specified in the control panel. See Settings section for values.
Ian
Yeah, well I'm gonna build my own lunar space lander! With blackjack aaaaannd Hookers! Actually, forget the space lander, and the blackjack. Ahhhh forget the whole thing!
-
Oct 6th, 2000, 05:26 AM
#3
Thread Starter
Addicted Member
Thanx Ian
Cheers Ian, I havn't got the MSDN library, wish I had,
Thanks again
Cheers 'n' beers
skeen
"It wasn't the booze that made me snooze, It was the Gin that did me in!"
-
Oct 6th, 2000, 05:29 AM
#4
Fanatic Member
If you go to http://msdn.microsoft.com
You can get to everything and a lot more. Takes a while sometimes to find what your looking for, but it is the number one resource for any thing microsofty
Ian
Yeah, well I'm gonna build my own lunar space lander! With blackjack aaaaannd Hookers! Actually, forget the space lander, and the blackjack. Ahhhh forget the whole thing!
-
Oct 6th, 2000, 11:10 AM
#5
Fanatic Member
Do you think u can use Format Function for ASP / VB Script ??? Isn't it just for VB Reference ??? Not for ASP / VB Scripting ???
I've tried before, nd still can't use it...
Till now, I'm still using Round Function for formatting my decimal number.
And I'm still confuse about formatting my number into hundreds, thousands, million, etc...
or to format date...
Do you know how ???
Cheers,
Wen Lie
-
Oct 6th, 2000, 03:27 PM
#6
Frenzied Member
FormatNumber will not round. It will truncate. Depends on your needs I guess.
You can't use 'Format' in VBScript- It's FormatCurrency, FormatNumber, and FormatDateTime
oOOo--oOOo
__ /\/\onte96
oOOo--oOOo
Senior Programmer/Analyst
MCP
[email protected]
[email protected]
Your results may vary.. some restrictions may apply.. pricing and participation may vary.. not available in all states.. professional driver closed course..quantities limited..
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|