|
 |
asptoday_discuss thread: Changing decimal places
Message #1 by mail@c... on Wed, 10 Jul 2002 12:38:45
|
|
I have written a script to work out prices the trouble is if I have a
price at £11.50 it knocks off the last 0 to leave £11.5 and if something
is £11.00. I have tried Ccur(Price)it remains without the correct decimal
places.
Does anybody know a way I can force it to have two decimal places.
Many Thanks
Damien
Message #2 by "euan green" <euan_green@h...> on Wed, 10 Jul 2002 13:23:00 +0000
|
|
HI,
A fix could be to convert it into a string, do a length after the point
check and if it equals 1 then append a 0 to the string and change it back
to a float.
Not 100% sure if the 0 will remain when changed back to integer, but might
work
HTH
Euan
>From: mail@c...
>Reply-To: "ASPToday Discuss" <asptoday_discuss@p...>
>To: "ASPToday Discuss" <asptoday_discuss@p...>
>Subject: [asptoday_discuss] Changing decimal places
>Date: Wed, 10 Jul 2002 12:38:45
>
>I have written a script to work out prices the trouble is if I have a
>price at £11.50 it knocks off the last 0 to leave £11.5 and if something
>is £11.00. I have tried Ccur(Price)it remains without the correct decimal
>places.
>
>Does anybody know a way I can force it to have two decimal places.
>
>Many Thanks
>
>Damien
_________________________________________________________________
Join the world?s largest e-mail service with MSN Hotmail.
http://www.hotmail.com
Message #3 by "Julian Roberts" <jules@c...> on Wed, 10 Jul 2002 16:14:27
|
|
Use the FormatCurrency or FormatNumber function:
response.write FormatCurrency(myvar,2)
> I have written a script to work out prices the trouble is if I have a
p> rice at £11.50 it knocks off the last 0 to leave £11.5 and if
something
i> s £11.00. I have tried Ccur(Price)it remains without the correct
decimal
p> laces.
> Does anybody know a way I can force it to have two decimal places.
> Many Thanks
> Damien
|
|
 |