Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Web Programming > JavaScript > Javascript How-To
| Search | Today's Posts | Mark Forums Read
Javascript How-To Ask your "How do I do this with Javascript?" questions here.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Javascript How-To section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old January 19th, 2004, 03:33 PM
Authorized User
 
Join Date: Jun 2003
Location: Stockton, CA, USA.
Posts: 27
Thanks: 0
Thanked 0 Times in 0 Posts
Default Display currency amounts, including cents.

Greetings,

How do I display monetary amounts in a format $x.xx (with cents included)?

Without formatting the output, an amount $7.00 will display as $7 (as an integer).

Thank you,
Daniel Hutchins (no computer nickname yet)

Thank you,
Daniel Hutchins
Woodbridge, CA
http://www.finehomemadesoap.com
__________________
Daniel Hutchins
Stockton, CA
http://www.finehomemadesoap.com
 
Old January 19th, 2004, 06:57 PM
Friend of Wrox
 
Join Date: Jun 2003
Location: High Wycombe, UK, United Kingdom.
Posts: 344
Thanks: 0
Thanked 1 Time in 1 Post
Default

Try converting the value to a string and then doing the otherstuff :

Dim myValue
myValue = <currency value>

' if no decimal component
if (InStr(myValue,".")=0) then
    myValue=myValue & ".00"
end if

' add the currency symbol
myValue="$" & myValue

' print it
Response.Write(myValue)




Similar Threads
Thread Thread Starter Forum Replies Last Post
datagridview currency format rounds off cents TomH VB Databases Basics 2 September 12th, 2006 11:24 AM
Display 0 currency as Null String echovue Access 5 August 11th, 2005 02:33 PM
Storing Large Amounts Of Data TSEROOGY Classic ASP Databases 3 October 26th, 2004 02:12 AM
Display a Text Field as Currency on a Report CloudNine Access 1 April 8th, 2004 01:24 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.