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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Time checks

Status
Not open for further replies.

dellyjm

Programmer
Apr 13, 2000
168
JM
Hi everyone.

I'm a VB developer using fox. Fox is new to me.

How do i compare time variables? e.g. Time() > "10:00:02"

Delton.


 
Hi Delton,

You've got the format right. Time variables are stored in 8-character format, hh:mm:ss. Comparison is as with any character strings.

Jim
 
Hi Delton,

I havent' used the Time() function much but I just did some testing.

Assuming that the current time is 08:00:00 you would get the following results.

? Time() > "07:00:00" && evaluate the expression and print the results to the screen
.T. && Returns True

? Time() > "09:00:00" && Returns False
.F.

Hope that helps and maybe others will respond with other ideas.

Chuck Davis
 
Ok, good.

Now how do i find out the difference in minutes.

When I say minutes = time() - "10:00:02" i don't get the desired results.

How can i know how many minutes between timex and timey?

Delton.
 
If you want to do time arithmetic I find it easier to create the variables as datetimes. Datetime variables can be added, subtracted, compared, etc.

x = time()
x = x + 7 && doesn't work

x = datetime()
x = x + 7 && works

Jim
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top