PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Tuesday, August 9, 2022

[FIXED] How to Format decimal in C# and keep ending 0?

 August 09, 2022     c#, decimal, format     No comments   

Issue

In C# how can I format $2,471,450.5 to $2,471,450.50 (Keeping Zero at the end)

This is the expression I'm using to format it and get this value $2,471,450.5 But I've trouble to display like this $2,471,450.50

String.Format(culture, "{0:$#,#.##;($#,#.##)}", rdr.GetDecimal(10))

Solution

This is the correct expression. Changed # to 0. Thank you for your help.

String.Format(culture, "{0:$#,#.00;($#,#.##)}", rdr.GetDecimal(10))


Answered By - Partha
Answer Checked By - Terry (PHPFixing Volunteer)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing