The Current week dates
- by MoezMousavi
The Current week dates
Might be a bit vierd as we normaly not writing a multicultural web site. So not very frequently using CultureInfo however, it is actully quite good to use it to get the week days.
CultureInfo info = Thread.CurrentThread.CurrentCulture;
DayOfWeek firstday = info.DateTimeFormat.FirstDayOfWeek;
DayOfWeek today = info.Calendar.GetDayOfWeek(DateTime.Now);
int diff = today - firstday;
DateTime firstDate = DateTime.Now.AddDays(-diff);
DateTime lastDate = firstDate.AddDays(6);