|
Post by sebacuenca on May 10, 2007 17:16:10 GMT
hi. Im pgramming a programm to calculate the time taken by the employees in one of my friend´s company. I´d like to know how to do and if i have to use time$ in order to calculate the amount of minutes. For intance: A person takes the break at 9.20 and finishes it at 9.30 and always taking the time using time$. How can i do to calculate (9.30-9.20=10). Do i have to use time$, how? thank you very much. Sebastian
|
|
|
Post by Ildûrest on May 10, 2007 22:19:29 GMT
TIME$ returns a string in the format xx:xx:xx, you can use MID$ to take parts of it.
E.g.
Hours = VAL(MID$(TIME$, 1, 2))
Similarly for the other values, then you can do arithmetic on two sets of time values. Look up MID$ and VAL in QB help for more information.
An alternative is to use TIMER; this returns the number of seconds elapsed since midnight. By finding the difference (and dividing by 60 or whatever you need) you can achieve the desired effect. However problems occur when the two times are from different days; you may need to use DATE$ if you need to compare times over more than one day.
|
|