虽然我知道如何做到这一点,但在我的脑海中,我想确保我正在充分利用执行任务的语法。
我期待取一个日期,并添加35天的增量,直到它在未来达到一个日期。
有没有一种更好的方式在VB.NET中做到这一点?增加日期35天,并将结果存储在数组中
'\* define the end of the repeat period (where dteValuationDate is, say, 01/01/2016)...
dteReminderEndDate = DateAdd(DateInterval.Month, 15, dteValuationDate)
'\* define the start date for the loop (which is a specific date, say, 17/05/2016, and add 70 days to it)...
dteLoopStart = DateAdd(DateInterval.Day, 70, dteStartDate)
intDateCount = 1
While dteRollingDate < dteReminderEndDate
'\* calculate the actual unadjusted rolling date...
dteRollingDate = DateAdd(DateInterval.Day, (intDateCount * 35), dteLopStart)
_dteReminderDates(intDateCount) = dteRollingDate
intDateCount = intDateCount + 1
ReDim Preserve _dteReminderDates(intDateCount)
End While
所以我只想存储结束日期之前的日期,即01/01/2016 + 15个月。虽然我很舒服,我正在做的事情基本上是'正确的',但我很想知道是否有更好的方法来做到这一点?
请停止使用行由行留言,让我们为自己的代码说话 –