hello every one. i have a list of data with a datetime field on it. i want to group the records by their week number. as say in list i have date value with 11-17-2012, 11-14-2012, 11-03-2012 so in the grouped list the record should be as first week => sum of
other value field secod week => sum of other field. please need urgent help.
imteyazahmad...
Member
286 Points
131 Posts
filter by week number
Nov 18, 2012 06:06 AM|LINK
Decker Dong ...
All-Star
118619 Points
18779 Posts
Re: filter by week number
Nov 19, 2012 12:31 AM|LINK
Hi,
I wonder what the week number is? Do you mea "17", "14" or "3"? And the number is so different from each other, how to group them?
Yannick86
Member
565 Points
366 Posts
Re: filter by week number
Nov 20, 2012 01:43 PM|LINK
Think this what you're looking for:
DateTime now = DateTime.Now;
System.Globalization.CultureInfo cult_info = System.Globalization.CultureInfo.CreateSpecificCulture("no");
System.Globalization.Calendar cal = cult_info.Calendar;
int weekCount = cal.GetWeekOfYear(now, cult_info.DateTimeFormat.CalendarWeekRule, cult_info.DateTimeFormat.FirstDayOfWeek);