且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何检查warrantstatustime是否小于当前时间?

更新时间:2022-06-25 23:24:35

替换

Replace
If ((dtmNewWarrantStatusDateTime.Date = Date.Today) And (DateDiff(DateInterval.Minute, Date.Now, dtmNewWarrantStatusDateTime) < 4)) Then
Else

If (Date.Now < dtmNewWarrantStatusDateTime) Then
Else



但***是


but preferably

If (Date.Now > dtmNewWarrantStatusDateTime) Then

当你有一个空的'then'分支时,当有人看你的代码时会让人感到困惑。



如果您允许的是4分钟的窗口,请从date.now中减去dtmNewWarrantStatusDateTime并检查timeinterval结果的totalminutes属性。

When you have an empty 'then' branch it is confusing when someone looks at your code.

If you are allowing a 4 minute window as it appears you are, subtract the dtmNewWarrantStatusDateTime from date.now and examine the timeinterval result's totalminutes property.

if ((date.now - dtmNewWarrantStatusDateTime).TotalMinutes < 4) then