雖然我知道如何做到這一點,但在我的腦海中,我想確保我正在充分利用執行任務的語法。
我期待取一個日期,並添加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個月。雖然我很舒服,我正在做的事情基本上是'正確的',但我很想知道是否有更好的方法來做到這一點?
請停止使用行由行留言,讓我們爲自己的代碼說話 –