1and1 Help Centre Categories

print article

Date and Currency Format 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));