RSS

Use Currency Format For Different Cultures c#

18 Oct

            double value = 5623345.6789;

            //For Default System Culture

            // By default, single letter C displays currency upto two decimal digits

            Console.WriteLine(value.ToString(“C”, CultureInfo.CurrentCulture));

            // C2 displays currency upto two digits

            Console.WriteLine(value.ToString(“C2”, CultureInfo.CurrentCulture));

            // C3 displays currency upto three digits

            Console.WriteLine(value.ToString(“C3”, CultureInfo.CurrentCulture));

            // C4 displays currency upto four digits

            Console.WriteLine(value.ToString(“C4”, CultureInfo.CurrentCulture));

            // C5 displays currency upto five digits

            Console.WriteLine(value.ToString(“C5”, CultureInfo.CurrentCulture));

            //For Japan Format

            Console.WriteLine(“\n——— Dispalying Currency for Japan —————\n”);

            Console.WriteLine(value.ToString(“C”, CultureInfo.CreateSpecificCulture(“ja-JP”)));

            //For Denmark Format

            Console.WriteLine(“\n——— Dispalying Currency for Denmark —————\n”);

            Console.WriteLine(value.ToString(“C”,       CultureInfo.CreateSpecificCulture(“da-DK”)));

           if Possible same program use with Multiple currencies and you want to fix currency not dependent on Culture then use this

      lblCustomerPayment.Text = string.Format(new CultureInfo(“en-US”, true), “{0:C2}”, value );

For more Help to Explore this below link

https://www.c-sharpcorner.com/UploadFile/0f68f2/converting-a-number-in-currency-format-for-different-culture/

 

Advertisements
 
Leave a comment

Posted by on October 18, 2018 in ASP Dot Net C#, WinForm

 

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

 
%d bloggers like this: