本文介绍了如何在“当前周"中找到周末在asp.net的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
谁能告诉我如何找到当前周的周六和周日
Can anyone tell me how to find Saturday and Sunday in current week
推荐答案
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的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!