-2

我在 VB.NET 应用程序中有 2 个 DateTime 值。

将 startDate 调暗为 DateTime 将 endDate 调暗为 DateTime

现在我想在 startDate 和 endDate 之间的每一天做一个循环,比如:

对于每一天作为整数 ????????????

下一个

有人有想法吗?

4

2 回答 2

2

C#

for(DateTime CurrentDate = StartDate; 
    CurrentDate < EndDate; 
    CurrentDate = CurrentDate.AddDays(1))
{
}

VB.NET

Dim CurrentDate As DateTime = StartDate
While CurrentDate < EndDate
    CurrentDate = CurrentDate.AddDays(1)
End While
于 2011-01-26T08:20:04.830 回答
1
Dim currentDate As Date = startDate 
While currentDate <= endDate
    'do something with this date...'
    currentDate = currentDate.AddDays(1)
End While
于 2011-01-26T08:23:59.213 回答