Format number as money
34,336
Solution 1
While you could call string.format, I think it's easier to just call ToString on it.
decimal money = 9000m;
string formattedMoney = money.ToString("C");
Solution 2
decimal money = 1000;
Response.Write(string.Format("{0:C}", money));
The above is an example in C#.
Solution 3
Thought I'd add a C# 6 option with interpolated strings:
decimal money = 9000m;
string formatted = $"{money:C}";
Author by
Dad Daniel
Updated on July 09, 2022Comments
-
Dad Daniel almost 2 years
How do I format a number to look like this: 9,000 my database field is in money data type, when I pull it up I see it like this: 9000.0000 that don't look right to me (I would like it to look like a real money format)