Page 1 of 1

commas in money

Posted: Sat Feb 24, 2007 2:31 pm
by dstefani
How do I get a comma in a US dollar amount like $1925.95 to $1,925.95

Is the a way to format it, or do I have to do a regexp or something?

Thanks,

- dstefani

Posted: Sat Feb 24, 2007 2:36 pm
by feyd

Posted: Sat Feb 24, 2007 3:19 pm
by dstefani
OK, that's cool, but how about this:

I've got a number of 1200 I'm using sprint to add the two zeros after the decimal. It works.

How do I get the comma and the effect of sprintf ? ($1,200.00)

Maybe I'm missing something.

Thanks,

- dstefani

Posted: Sat Feb 24, 2007 3:36 pm
by nickvd
dstefani wrote:OK, that's cool, but how about this:

I've got a number of 1200 I'm using sprint to add the two zeros after the decimal. It works.

How do I get the comma and the effect of sprintf ? ($1,200.00)

Maybe I'm missing something.

Thanks,

- dstefani
I really don't mean to be rude.. but did you even read the manual page for money_format() that feyd posted???

It certainly doesn't seem like it.

Posted: Sat Feb 24, 2007 3:42 pm
by dstefani
It's OK, be rude, I scanned it, I'm doind 3 things at one.

When I posted the last one I felt a shiver of guilt as I posted (didn't do enough of my own research)

- Sorry

- dstefani :twisted: Evil laziness