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
views:
1158answers:
1
+2
A:
Yes, check DateTime.DayOfWeek.
Please note this depends on the regional settings (here in Europe Monday is the first day of the week).
Gerrie Schenck
2009-02-27 14:37:10
Be warned: this value varies by culture. Depending on where you are day 0 may be either Sunday or Monday.
Joel Coehoorn
2009-02-27 14:38:27
Already edited my post ;)
Gerrie Schenck
2009-02-27 14:38:50
Don't forget that you need to cast it back to an int to get it as a number.
R. Bemrose
2009-02-27 14:39:21
Use DateTimeFormatInfo.InvariantInfo.DayNames to avoid culture
Greg
2009-02-27 14:56:21