如何在“当前周"中找到周末在asp.net

编程入门 行业动态 更新时间:2024-10-10 13:22:32
本文介绍了如何在“当前周"中找到周末在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

本文发布于:2023-11-08 20:48:46,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1570419.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:周末   中找到   如何在   net   quot

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!