从Datetime.Now找到当前周以及如何在当前周日之间找到给定日期?

1)如何从C#中的当前日期时间中找到当前周?

2)然后我们必须找到给定的日期,相应的周日期是否存在?

请帮我解决一下吗?

int currentWeek = (DateTime.Now.DayOfYear / 7) + 1; 

你必须使用日历。

 Calendar cal = new Calendar(); int week = cal.GetWeekOfYear(DateTime time, calendarWeekRule rule, DayOfWeek firstDayOfWeek); 

点击此处: http : //msdn.microsoft.com/en-us/library/system.globalization.calendar.getweekofyear(v=vs.110).aspx

获取任何给定日期的周数:

 var culture = CultureInfo.CurrentCulture; int weekNo = culture.Calendar.GetWeekOfYear( new DateTime(YOUR_GIVEN_DATE_HERE), currentCulture.DateTimeFormat.CalendarWeekRule, currentCulture.DateTimeFormat.FirstDayOfWeek); 

只需用Datetime.Now(当前日期)或您的任何给定日期替换YOUR_GIVEN_DATE_HERE。 如果weekNos相等,则它们在同一周。 这将解决你的两个问题。