本文介绍了如何在“当前周"中找到周末在asp的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
谁能告诉我如何找到当前周的周六和周日
Can anyone tell me how to find Saturday and Sunday in current week
推荐答案
类似的方法应该对您有用-
Something like this should work for you - DateTime GetDateFromDay(DayOfWeek dayOfWeek, int searchDirection) { if (Math.Abs(searchDirection) != 1) throw new ArgumentException("Must be 1 or -1", "searchDirection"); DateTime testDate = DateTime.Today; while (testDate.DayOfWeek != dayOfWeek) testDate = testDate.AddDays(searchDirection); return testDate; }
这是一个非常基本的问题.它与ASP.NET无关.如果您认为确实如此,则需要进行一些基础研究.实际上,无论哪种方式,您都需要阅读基础书籍. DateTime类将告诉您给定日期的星期几,因此您可以使用它来确定周末的星期几. This is an incredibly basic question. And it has NOTHING to do with ASP.NET. If you think it does, you need to do some basic research. Actually, either way, you need to read a basic book. The DateTime class will tell you the day of the week for the given date, so you can use that to work out what days are on the weekend.
更多推荐
如何在“当前周"中找到周末在asp.net
发布评论