I have applicaction C# asp net MVC posted on a server, the server this in Spanish but show the date in the report(Crystal report) in english..
How can I show it in Spanish?
the date of above is "Date of the data (crystal report)" and the other two dates below are you enter the application
PD: Its important to mention my pc this in Spanish and so the date this in Spanish when I change my pc a English the date change English.
You should use the class CultureInfo
, which enables you to specify any language and styles for a language and/or a country. You can read about the .NET supported cultures here. In this case, you simply should convert your date to a string with the version of ToString()
that takes a CultureInfo
as a parameter. You can create this culture in your code, or access the default culture (the default is your computer's language, but in ASP.NET, you can keep a special culture for each user). Here's an example:
using System.Globalization;
// ...
yourDate.ToString(new CultureInfo("es-ES")); // Convert the date to a normal date string with Spain's Spanish culture