Globalization

Globalization

The DateTime.Parse() method (explained in the previous post) only parses the date given to the selected culture. To be sure that you are using the same culture throughout the whole application (ASP .Net), you need to add the following code in the web.config of your app (this must be inserted in the <system.web> section)…

<globalization culture=en-GB uiCulture=en-GB/>

There are various cultures that can be used. In this case, I used the en-GB culture (English/United Kingdom) as the date will be passed as dd/mm/yyyy throughout the whole app. For US culture, you can use the en-US (English/United States) and the dates will be passed as mm/dd/yyyy.

For more information regarding cultures and uiculture check here.

Advertisements