11 April, 2010
0 Comments
1 category
If you want to determine the datetime of the first day of the week, you can use the following code:
// Get the first day of the week DayOfWeek firstDay = System.Threading.Thread.CurrentThread.CurrentCulture.DateTimeFormat.FirstDayOfWeek; DateTime firstDayOfWeekDateTime = DateTime.Now; while (firstDayOfWeekDateTime.DayOfWeek != firstDay) { firstDayOfWeekDateTime = firstDayOfWeekDateTime.AddDays(-1); }
Tags: C#
Category: Uncategorized