C# – Return index value datetime.now.dayofweek but how


is there any function of datetime return dayofweekindex? such as:
int Todaywhat_is_Index= = DateTime.Now.IndexOfDayofThisWeek;
if Today is friday, it must be return 5
ifToday is Saturday, it must be return 6
ifToday is Sunday, it must be return 0

Best Solution

This little one-liner works independent of locale, with always Friday == 5

int x = (int)System.Globalization.CultureInfo