Oct 27, 2004 #1 malonep Programmer Joined Jul 14, 2004 Messages 44 Location CA Hi, I have a start and end date time set in a cursor and I want to see if "now" is between the start and end. How do I compare times while ignoring the dates? I have been using datetime but it compares dates before time.
Hi, I have a start and end date time set in a cursor and I want to see if "now" is between the start and end. How do I compare times while ignoring the dates? I have been using datetime but it compares dates before time.
Oct 27, 2004 #2 jimstarr Programmer Joined Feb 6, 2001 Messages 975 Location US SET HOURS TO 24 startx = TTOC(start, 2) endx = TTOC(end, 2) now = TTOC(DATETIME(), 2) ?BETWEEN(now, startx, endx) Jim Upvote 0 Downvote
SET HOURS TO 24 startx = TTOC(start, 2) endx = TTOC(end, 2) now = TTOC(DATETIME(), 2) ?BETWEEN(now, startx, endx) Jim
Oct 27, 2004 #3 KDavie Programmer Joined Feb 10, 2004 Messages 441 Location US This may not be the best way, but I guess you could do something like this: Code: ldTestTime = TIME() lcStrTran = TTOD(ldStart) && Starting Date ldStart = STRTRAN(ldStart,lcStrTran,"") lcStrTran = TTOD(ldEnd) && Ending Date ldEnd = STRTRAN(ldEnd,lcStrTran,"") IF BETWEEN(ldTestTime,ldStart,ldEnd) ***your code here ENDIF Hope this helps. -Kevin Upvote 0 Downvote
This may not be the best way, but I guess you could do something like this: Code: ldTestTime = TIME() lcStrTran = TTOD(ldStart) && Starting Date ldStart = STRTRAN(ldStart,lcStrTran,"") lcStrTran = TTOD(ldEnd) && Ending Date ldEnd = STRTRAN(ldEnd,lcStrTran,"") IF BETWEEN(ldTestTime,ldStart,ldEnd) ***your code here ENDIF Hope this helps. -Kevin