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!

Query and Time fields

Status
Not open for further replies.

Mojster

Programmer
Sep 26, 2001
18
SI
How can I substract one Time from another Time with query, to get time difference as result?

Thx!

 
You would have to use example elements to identify each of the two time fields, then have a third time field to hold the result.

Code:
:myAlias:myTable.db | Time1 | Time2 | TimeDif    |
                    | _tim1 | _tim2 | .., changeto _tim2-_tim1 |

Remember, times are stored by Paradox internally as long integers but displayed according to Windows settings, so your result may not look right until you convert it to something like minutes (it will look like a time value).

In my test I used 12:15:00 AM and 02:15:00 AM and the result was 2:00:00 AM, which is stored as a long integer value of 7200000 (120 minutes).

view(longInt(time("02:00:00 AM")/60000)

Mac :)

"Do not delve too deeply in the arts of your enemy and so become ensnared by them"

langley_mckelvy@cd4.co.harris.tx.us
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top