Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Web Programming > JavaScript > Javascript How-To
Password Reminder
Register
| FAQ | Members List | Calendar | 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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
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
Reply With Quote
  #2 (permalink)  
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)
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


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



All times are GMT -4. The time now is 09:36 AM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.