`///    ``/// 判断两个日期是否在同一周   ``///    ``/// 开始日期   ``/// 结束日期  ``///    ``private` `bool` `IsInSameWeek(DateTime dtmS, DateTime dtmE)  ``{  ``    ``TimeSpan ts = dtmE - dtmS;  ``    ``double` `dbl = ts.TotalDays;  ``    ``int` `intDow = Convert.ToInt32(dtmE.DayOfWeek);  ``    ``if` `(intDow == 0) intDow = 7;  ``    ``if` `(dbl >= 7 || dbl >= intDow) ``return` `false``;  ``    ``else` `return` `true``;  ``} `

 1234567891011121314151617181920212223242526272829303132333435 `///   ``/// 某日期是本月的第几周  ``///   ``///   ``///   ``///   ``private` `int` `WeekOfMonth(DateTime dtSel, ``bool` `sundayStart)  ``{  ``    ``//如果要判断的日期为1号，则肯定是第一周了   ``    ``if` `(dtSel.Day == 1) ``return` `1;  ``    ``else``    ``{  ``        ``//得到本月第一天   ``        ``DateTime dtStart = ``new` `DateTime``        ``(dtSel.Year, dtSel.Month, 1);  ``        ``//得到本月第一天是周几   ``        ``int` `dayofweek = (``int``)dtStart.DayOfWeek;  ``        ``//如果不是以周日开始，需要重新计算一下``        ``//dayofweek，详细风DayOfWeek枚举的定义   ``        ``if` `(!sundayStart)  ``        ``{  ``            ``dayofweek = dayofweek - 1;  ``            ``if` `(dayofweek < 0) dayofweek = 7;  ``        ``}  ``        ``//得到本月的第一周一共有几天   ``        ``int` `startWeekDays = 7 - dayofweek;  ``        ``//如果要判断的日期在第一周范围内，返回1   ``        ``if` `(dtSel.Day <= startWeekDays) ``return` `1;  ``        ``else``        ``{  ``            ``int` `aday = dtSel.Day + 7 - startWeekDays;  ``            ``return` `aday / 7 + (aday % 7 > 0 ? 1 : 0);  ``        ``}  ``    ``}  ``}`