DateTime.Now.DayOfWeek.ToString() with CultureInfo

PassionateDeveloper picture PassionateDeveloper · Apr 19, 2011 · Viewed 88.7k times · Source

I have the code:

DateTime.Now.DayOfWeek.ToString()

That give's me the english day of the week name, I want to have the german version, how to add CultureInfo here to get the german day of the week name?

Answer

Diego Torres picture Diego Torres · Apr 19, 2011
var culture = new System.Globalization.CultureInfo("de-DE");
var day = culture.DateTimeFormat.GetDayName(DateTime.Today.DayOfWeek);