How do I format a double to currency rounded to the nearest dollar?

后端 未结 6 1088
春和景丽
春和景丽 2020-12-05 03:58

Right now I have

double numba = 5212.6312
String.Format(\"{0:C}\", Convert.ToInt32(numba) )

This will give me

$5,213.00
         


        
6条回答
  •  长情又很酷
    2020-12-05 04:45

    simple: numba.ToString("C2")

    more @ http://msdn.microsoft.com/pt-br/library/dwhawy9k(v=vs.110).aspx#CFormatString

提交回复
热议问题