Select Category
Sitemap Help Contact
print article

Change the Date and Currency Format in ASP.NET

Follow the steps below to change the format for the date and currency in ASP.NET.

The .NET Framework was built to support a variety of international formats for data like date, time, calendar, currency, numbers, etc. This functionality is provided in the namespace System.Globalization.

The default culture for incoming requests can be set in web.config using the following configuration tag:

<globalization culture="en-US" />

As an alternative, a different format can be set through string-formatting in code. Example for displaying a currency in different cultures:

int i = 100;

CultureInfo ci_us = new CultureInfo("en-US"); 'English - United States
Response.Write(i.ToString("c", ci_us));

For additional information, you may want to reference: