Click to See Complete Forum and Search --> : Format figures drawn from database
Steve_FX
01-24-2006, 03:50 AM
Have an ecommerce website built utilising ASP/VBScript with an access database... the website works great except for one small problem the prices which are pulled from a recordset are not being formatted correctly, in that they are displayed as $25.6 or $25 or even $25.60 ... is there a way to ensure the format $xx.xx is displayed?
Thanks
Steve
gintom
01-24-2006, 07:14 AM
FormatNumber(25.5,2) this will format the number to have 2 numbers after the deciaml place. eg. 25.50 will be the out come.
Bullschmidt
01-29-2006, 05:50 PM
And for more about FormatNumber() and other VBScript functions:
Visual Basic Scripting Edition Functions
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/script56/html/adaabd2b-250e-4040-9eaa-127f5a41f8b9.asp
buntine
01-30-2006, 06:43 AM
FormatCurrency(25.5)
This will produce the same result as FormatNumber(25.5), but it will also prefix the double with a dollar sign (or the national currency identifier according to the locale of the server).
I would recommend it, provided it does infact return a number to the second decimal point. Have a look at the documentation; there may be a paramater to control the number of decimal places displayed.
Regards.
mrmazur
02-14-2006, 04:34 PM
FormatCurrency...Awesome...this is exactly what I was just looking for. Thanks for the help!