Reputation: 37633
Is it possible to get DayOfWeek for a specific culture?
Any clue?
Thank you!!!
Upvotes: 2
Views: 4713
Reputation: 3721
Try the following:
DateTime.Now.ToString("dddd", new System.Globalization.CultureInfo("ar-EG"))
For details, MSDN
Upvotes: 6
Reputation: 1520
string myTime = DateTime.Now.ToString("dddd", new System.Globalization.CultureInfo("it-IT"));
the example use italian culture code, for a list of available culture codes check out this
Upvotes: 1
Reputation: 460098
Do you want to get the day name of today's DayOfWeek
in a given culture?
DateTime.Now.ToString("dddd", new System.Globalization.CultureInfo("de-DE"))
("Montag" for germany)
Upvotes: 3
Reputation: 217273
You can get the localized names of days from the DateTimeFormatInfo.DayNames Property:
var cultureInfo = new CultureInfo("de-DE");
var dateTimeInfo = cultureInfo.DateTimeFormat;
var dayNames = dateTimeInfo.DayNames;
var result = dayNames[(int)DayOfWeek.Wednesday];
// result == "Mittwoch"
Upvotes: 2