【发布时间】:2010-07-19 19:47:05
【问题描述】:
可能重复:
How do I determine if a given date is Nth weekday of the month?
我如何获得每月的第 n 个工作日?
例如:
“2010 年 7 月”的第 2 个星期一 = 07/12/2010。
寻找类似的功能:
public DateTime GetNthWeekofMonth(DateTime date, int nthWeek, DayOfWeek dayofWeek)
{
//return the date of nth week of month
}
由上可知,函数的参数为("Any Date in July 2010", 2, Monday)。
【问题讨论】:
-
不清楚您在这里期望什么输入和输出。请澄清。
-
我添加了一个类似问题的答案,它返回一个 DateTime 列表,以防您在 stackoverflow.com/questions/288513/… 需要的不仅仅是一个 DateTime