Globalization in ASP.NET should do everything for you to a large extent. See this MSDN article entitled How to Customize UI Culture and Culture for Globalizing ASP.NET Web Pages . This should be exactly what you want, because you just need to set the current (UI) culture for the current stream when the user logs in. Then you can call date.ToString()and return the text view in the correct format.
Equivalently, you could do something like this:
var culture = System.Globalization.CultureInfo.GetCultureInfo("en-GB");
var dateString = date.ToString(culture.DateTimeFormat);
But it really just does the same thing manually, and much less elegantly. You can also use the ASP.NET globalization infrastructure.
source
share