Re: Formatting Numbers
by "Rossi Designs" <webmaster(at)rossidesigns.net>
|
Date: |
Wed, 22 Mar 2000 12:08:18 -0500 |
To: |
"Franklin, Douglass" <Douglass.Franklin(at)ssa.gov>, "'HTML Writer's Guild - Languages'" <hwg-languages(at)hwg.org> |
References: |
ssa |
|
todo: View
Thread,
Original
|
|
in javascript
function moneyFormat(num) {
num = eval(num);
num *= 100;
num = Math.round(num)/100;
if (num - Math.floor(num) == 0) {
num = num + ".00";
}
else {
string = num.toString();
parts = string.split(".");
cents = parts[1];
if (cents.length == 1) {
num = num + "0";
}
}
return num;
}
in PHP
$num = number_format($num,2);
Rossi Designs
(904) 226-8979
P.O. Box 1084, Holly Hill, Florida 32125-1084
http://rossidesigns.net
----- Original Message -----
From: Franklin, Douglass <Douglass.Franklin(at)ssa.gov>
To: 'HTML Writer's Guild - Languages' <hwg-languages(at)hwg.org>
Sent: Wednesday, March 22, 2000 10:52 AM
Subject: Formatting Numbers
| Is it possible to output numbers in a "currency format"? Where would look
| for information on formatting numbers? (I regret if I'm offending anyone
| with my "info-greediness". I will help others the minute I see an
| opportunity.)
|
| TIA,
|
| - Doug
|
| Doug Franklin
| Social Security Administration
| Office of International Operations
| Module 1
| Benefit Authorizer
| Site LAN Coordinator
| Site Training Coordinator
| (410) 966-3735
|
|
HWG: hwg-languages mailing list archives,
maintained by Webmasters @ IWA