我正在尝试获取本周星期一的日期。这接近正确吗?
Dim MondayOfCurrentWeek As Date = Date.Today - Date.Today.DayOfWeek + 1
据我了解,AyOfWeek 索引是:
1 = Monday
2 = Tuesday
3 = Wednesday
4 = Thursday
5 = Friday
6 = Saturday
0 = Sunday
因此,如果例如今天的日期是星期四,我会得到:
Dim MondayOfCurrentWeek As Date = Date - 4 + 1
这将等于
Date - 3
对我来说似乎是正确的。
还是我完全不在了?