Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

comparing times

Status
Not open for further replies.

malonep

Programmer
Jul 14, 2004
44
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.
 
SET HOURS TO 24
startx = TTOC(start, 2)
endx = TTOC(end, 2)
now = TTOC(DATETIME(), 2)
?BETWEEN(now, startx, endx)

Jim
 
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
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top