Hi guys,
I am struggling with this Time comparison :
I need to check if the time range 10:00 PM - 10:15 PM falls between the range 09:59 PM - 12:02 AM.
I tried various ways to compare but no luck.
here's what my code looks like:
Assume T1 = 09:59 PM , T2 = 12:02 AM, tempT1=10:00 PM , tempT2 = 10:15 PM.
' check if T1 is between tempT1 & tempT2
If FormatDateTime(T1, DateFormat.ShortTime) <= FormatDateTime(tempT1 , DateFormat.ShortTime) And _
FormatDateTime(T2, DateFormat.ShortTime) >= FormatDateTime(tempT2, DateFormat.ShortTime) Then
'**** do something
end if
'check if tempT2 falls in T & t2.
If FormatDateTime(tempT2, DateFormat.ShortTime) > FormatDateTime(T1, DateFormat.ShortTime) And _
FormatDateTime(tempT2, DateFormat.ShortTime) <= FormatDateTime(T2, DateFormat.ShortTime) Then
'**** do something
end if
Can someone help? Appreciate it.
I am struggling with this Time comparison :
I need to check if the time range 10:00 PM - 10:15 PM falls between the range 09:59 PM - 12:02 AM.
I tried various ways to compare but no luck.
here's what my code looks like:
Assume T1 = 09:59 PM , T2 = 12:02 AM, tempT1=10:00 PM , tempT2 = 10:15 PM.
' check if T1 is between tempT1 & tempT2
If FormatDateTime(T1, DateFormat.ShortTime) <= FormatDateTime(tempT1 , DateFormat.ShortTime) And _
FormatDateTime(T2, DateFormat.ShortTime) >= FormatDateTime(tempT2, DateFormat.ShortTime) Then
'**** do something
end if
'check if tempT2 falls in T & t2.
If FormatDateTime(tempT2, DateFormat.ShortTime) > FormatDateTime(T1, DateFormat.ShortTime) And _
FormatDateTime(tempT2, DateFormat.ShortTime) <= FormatDateTime(T2, DateFormat.ShortTime) Then
'**** do something
end if
Can someone help? Appreciate it.