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

Help - DBASE Time expression

Status
Not open for further replies.

Kitaro

Technical User
Jan 28, 2005
12
US
Kitaro (TechnicalUser) Feb 27, 2005
Does anyone know if you can perform mathmatical calculations using a time expression with DBASE?

I need to perform calculations using either example below with military time:

1st example:

Time1 = 12:00 Time2 = 16:00

Time2 - Time1 = (4 Hours)
---------------------------------------
2nd example:

Time3 = 23:00

Time4 = Time3 + 3 hours (to equal 2am)
 
I don't believe that dBase provided a way to convert strings to time si I think you're going to have to create your own procedure to convert the various parts of time (hrs, min, sec) to numeric values and to perform the math.

There's always a better way. The fun is trying to find it!
 
I agree. Depending on the application and how often the calculations have to be done, I believe I've done both of :

Store time values as characters like 24:00 and extract the hours and minutes using the int(substr(xxxx)) construct (if time calculations infrequent)

OR

Store time values as separate integer numeric fields of length 2, so data is like HRS=24 MINS =00.

Either way, TVI's right about writing your own procedure to do the calculations.

dennis
 
ok - thanks!

Just wanted to know if there was an easier way since the Date() expression had a similar function for days (Date()+5)

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top