RSS

Monthly Archives: October 2018

Use Currency Format For Different Cultures c#


            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