How can i convert decimal to number as my variable is in decimal type

Hi Team,

TaxAmt = 243.6789

TaxAmt is decimal type variable.

i want to convert this value to below one of format

TaxAmt= 243.6 or TaxAmt= 244

Help out please

Hi,

Hope the following expressions help you.

Rounding

Math.Round(Decimal.ToDouble(taxAmt),MidpointRounding.AwayFromZero)    244

Math.Round(Decimal.ToDouble(taxAmt),1,MidpointRounding.AwayFromZero)   243.7

Rounding down

Math.Floor(Decimal.ToDouble(taxAmt))   243

Math.Floor(Decimal.ToDouble(taxAmt)*10.0)/10.0   243.6

Regards,

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.